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

Side by Side Diff: chrome/browser/page_cycler/page_cycler.cc

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/global_keyboard_shortcuts_mac.h ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/page_cycler/page_cycler.h" 5 #include "chrome/browser/page_cycler/page_cycler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/string_split.h" 13 #include "base/string_split.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/test/base/chrome_process_util.h" 18 #include "chrome/test/base/chrome_process_util.h"
18 #include "chrome/test/perf/perf_test.h" 19 #include "chrome/test/perf/perf_test.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
24 25
25 using content::NavigationController; 26 using content::NavigationController;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 content::BrowserThread::PostTask(content::BrowserThread::UI, 226 content::BrowserThread::PostTask(content::BrowserThread::UI,
226 FROM_HERE, 227 FROM_HERE,
227 base::Bind(&PageCycler::Finish, this)); 228 base::Bind(&PageCycler::Finish, this));
228 } 229 }
229 } 230 }
230 231
231 void PageCycler::Finish() { 232 void PageCycler::Finish() {
232 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 233 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
233 BrowserList::RemoveObserver(this); 234 BrowserList::RemoveObserver(this);
234 browser_->OnWindowClosing(); 235 browser_->OnWindowClosing();
235 browser_->ExecuteCommand(IDC_EXIT); 236 chrome::ExecuteCommand(browser_, IDC_EXIT);
236 Release(); // Balanced in PageCycler constructor; 237 Release(); // Balanced in PageCycler constructor;
237 // (only one of Finish/Abort should be called). 238 // (only one of Finish/Abort should be called).
238 } 239 }
239 240
240 void PageCycler::Abort() { 241 void PageCycler::Abort() {
241 browser_ = NULL; 242 browser_ = NULL;
242 BrowserList::RemoveObserver(this); 243 BrowserList::RemoveObserver(this);
243 Release(); // Balanced in PageCycler constructor; 244 Release(); // Balanced in PageCycler constructor;
244 // (only one of Finish/Abort should be called). 245 // (only one of Finish/Abort should be called).
245 } 246 }
246 247
247 void PageCycler::OnBrowserAdded(Browser* browser) {} 248 void PageCycler::OnBrowserAdded(Browser* browser) {}
248 249
249 void PageCycler::OnBrowserRemoved(Browser* browser) { 250 void PageCycler::OnBrowserRemoved(Browser* browser) {
250 if (browser == browser_) { 251 if (browser == browser_) {
251 aborted_ = true; 252 aborted_ = true;
252 error_.append(ASCIIToUTF16( 253 error_.append(ASCIIToUTF16(
253 "Browser was closed before the run was completed.")); 254 "Browser was closed before the run was completed."));
254 DLOG(WARNING) << 255 DLOG(WARNING) <<
255 "Page Cycler: browser was closed before the run was completed."; 256 "Page Cycler: browser was closed before the run was completed.";
256 content::BrowserThread::PostBlockingPoolTask( 257 content::BrowserThread::PostBlockingPoolTask(
257 FROM_HERE, 258 FROM_HERE,
258 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); 259 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this));
259 } 260 }
260 } 261 }
OLDNEW
« no previous file with comments | « chrome/browser/global_keyboard_shortcuts_mac.h ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698