Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: chrome/browser/extensions/extension_record_api.cc

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Indentation fixes and comment. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_record_api.h" 5 #include "chrome/browser/extensions/extension_record_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 RunPageCyclerFunction::~RunPageCyclerFunction() {} 44 RunPageCyclerFunction::~RunPageCyclerFunction() {}
45 45
46 bool RunPageCyclerFunction::RunImpl() { 46 bool RunPageCyclerFunction::RunImpl() {
47 if (!ParseJSParameters()) 47 if (!ParseJSParameters())
48 return false; 48 return false;
49 49
50 // If we've had any errors reportable to the JS caller so far (in 50 // If we've had any errors reportable to the JS caller so far (in
51 // parameter parsing) then return a list of such errors, else perform 51 // parameter parsing) then return a list of such errors, else perform
52 // RunTestBrowser on the BlockingPool. 52 // RunTestBrowser on the BlockingPool.
53 if (!errors_.empty()) { 53 if (!errors_.empty()) {
54 result_.reset(record::CaptureURLs::Result::Create(errors_)); 54 SetSingleResult(record::CaptureURLs::Result::Create(errors_));
55 SendResponse(true); 55 SendResponse(true);
56 } else { 56 } else {
57 content::BrowserThread::PostBlockingPoolTask(FROM_HERE, 57 content::BrowserThread::PostBlockingPoolTask(FROM_HERE,
58 base::Bind(&RunPageCyclerFunction::RunTestBrowser, this)); 58 base::Bind(&RunPageCyclerFunction::RunTestBrowser, this));
59 process_strategy_->PumpBlockingPool(); // Test purposes only. 59 process_strategy_->PumpBlockingPool(); // Test purposes only.
60 } 60 }
61 61
62 return true; 62 return true;
63 } 63 }
64 64
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 172
173 // CaptureURLsFunction adds "record-mode" to sub-browser call, and returns 173 // CaptureURLsFunction adds "record-mode" to sub-browser call, and returns
174 // just the (possibly empty) error list. 174 // just the (possibly empty) error list.
175 void CaptureURLsFunction::AddSwitches(CommandLine* line) { 175 void CaptureURLsFunction::AddSwitches(CommandLine* line) {
176 if (!line->HasSwitch(switches::kRecordMode)) 176 if (!line->HasSwitch(switches::kRecordMode))
177 line->AppendSwitch(switches::kRecordMode); 177 line->AppendSwitch(switches::kRecordMode);
178 } 178 }
179 179
180 void CaptureURLsFunction::Finish() { 180 void CaptureURLsFunction::Finish() {
181 result_.reset(record::CaptureURLs::Result::Create(errors_)); 181 SetSingleResult(record::CaptureURLs::Result::Create(errors_));
182 SendResponse(true); 182 SendResponse(true);
183 } 183 }
184 184
185 185
186 // ReplayURLsFunction ------------------------------------------------ 186 // ReplayURLsFunction ------------------------------------------------
187 187
188 ReplayURLsFunction::ReplayURLsFunction() 188 ReplayURLsFunction::ReplayURLsFunction()
189 : RunPageCyclerFunction(new ProductionProcessStrategy()), 189 : RunPageCyclerFunction(new ProductionProcessStrategy()),
190 run_time_ms_(0) { 190 run_time_ms_(0) {
191 } 191 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 run_time_ms_ = (base::Time::NowFromSystemTime() - timer_).InMilliseconds(); 238 run_time_ms_ = (base::Time::NowFromSystemTime() - timer_).InMilliseconds();
239 } 239 }
240 240
241 void ReplayURLsFunction::Finish() { 241 void ReplayURLsFunction::Finish() {
242 record::ReplayURLsResult result; 242 record::ReplayURLsResult result;
243 243
244 result.run_time = run_time_ms_; 244 result.run_time = run_time_ms_;
245 result.stats = stats_; 245 result.stats = stats_;
246 result.errors = errors_; 246 result.errors = errors_;
247 247
248 result_.reset(record::ReplayURLs::Result::Create(result)); 248 SetSingleResult(record::ReplayURLs::Result::Create(result));
249 SendResponse(true); 249 SendResponse(true);
250 } 250 }
251 251
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698