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

Side by Side Diff: chrome/browser/ui/browser_init.cc

Issue 5734002: Continuation of CL 5685007, rename the singleton accessor method in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ui/browser_init.h" 5 #include "chrome/browser/ui/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 bool process_startup, 390 bool process_startup,
391 int* return_code) { 391 int* return_code) {
392 in_startup = process_startup; 392 in_startup = process_startup;
393 DCHECK(profile); 393 DCHECK(profile);
394 #if defined(OS_CHROMEOS) 394 #if defined(OS_CHROMEOS)
395 if (process_startup) { 395 if (process_startup) {
396 // NetworkStateNotifier has to be initialized before Launching browser 396 // NetworkStateNotifier has to be initialized before Launching browser
397 // because the page load can happen in parallel to this UI thread 397 // because the page load can happen in parallel to this UI thread
398 // and IO thread may access the NetworkStateNotifier. 398 // and IO thread may access the NetworkStateNotifier.
399 chromeos::CrosLibrary::Get()->GetNetworkLibrary() 399 chromeos::CrosLibrary::Get()->GetNetworkLibrary()
400 ->AddNetworkManagerObserver(chromeos::NetworkStateNotifier::Get()); 400 ->AddNetworkManagerObserver(
401 chromeos::NetworkStateNotifier::GetInstance());
401 } 402 }
402 #endif 403 #endif
403 404
404 // Continue with the off-the-record profile from here on if --incognito 405 // Continue with the off-the-record profile from here on if --incognito
405 if (command_line.HasSwitch(switches::kIncognito)) 406 if (command_line.HasSwitch(switches::kIncognito))
406 profile = profile->GetOffTheRecordProfile(); 407 profile = profile->GetOffTheRecordProfile();
407 408
408 BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this); 409 BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this);
409 bool launched = lwp.Launch(profile, process_startup); 410 bool launched = lwp.Launch(profile, process_startup);
410 in_startup = false; 411 in_startup = false;
411 412
412 if (!launched) { 413 if (!launched) {
413 LOG(ERROR) << "launch error"; 414 LOG(ERROR) << "launch error";
414 if (return_code) 415 if (return_code)
415 *return_code = ResultCodes::INVALID_CMDLINE_URL; 416 *return_code = ResultCodes::INVALID_CMDLINE_URL;
416 return false; 417 return false;
417 } 418 }
418 419
419 #if defined(OS_CHROMEOS) 420 #if defined(OS_CHROMEOS)
420 // Create the WmMessageListener so that it can listen for messages regardless 421 // Create the WmMessageListener so that it can listen for messages regardless
421 // of what window has focus. 422 // of what window has focus.
422 chromeos::WmMessageListener::instance(); 423 chromeos::WmMessageListener::GetInstance();
423 424
424 // Create the SystemKeyEventListener so it can listen for system keyboard 425 // Create the SystemKeyEventListener so it can listen for system keyboard
425 // messages regardless of focus. 426 // messages regardless of focus.
426 chromeos::SystemKeyEventListener::instance(); 427 chromeos::SystemKeyEventListener::GetInstance();
427 428
428 // Create the WmOverviewController so it can register with the listener. 429 // Create the WmOverviewController so it can register with the listener.
429 chromeos::WmOverviewController::instance(); 430 chromeos::WmOverviewController::GetInstance();
430 431
431 // Install the GView request interceptor that will redirect requests 432 // Install the GView request interceptor that will redirect requests
432 // of compatible documents (PDF, etc) to the GView document viewer. 433 // of compatible documents (PDF, etc) to the GView document viewer.
433 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 434 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
434 if (parsed_command_line.HasSwitch(switches::kEnableGView)) { 435 if (parsed_command_line.HasSwitch(switches::kEnableGView)) {
435 chromeos::GViewRequestInterceptor::GetInstance(); 436 chromeos::GViewRequestInterceptor::GetInstance();
436 } 437 }
437 if (process_startup) { 438 if (process_startup) {
438 // TODO(dhg): Try to make this just USBMountObserver::Get()->set_profile 439 // TODO(dhg): Try to make this just USBMountObserver::Get()->set_profile
439 // and have the constructor take care of everything else. 440 // and have the constructor take care of everything else.
440 chromeos::MountLibrary* lib = 441 chromeos::MountLibrary* lib =
441 chromeos::CrosLibrary::Get()->GetMountLibrary(); 442 chromeos::CrosLibrary::Get()->GetMountLibrary();
442 chromeos::USBMountObserver* observe = chromeos::USBMountObserver::Get(); 443 chromeos::USBMountObserver* observe =
444 chromeos::USBMountObserver::GetInstance();
443 lib->AddObserver(observe); 445 lib->AddObserver(observe);
444 observe->ScanForDevices(lib); 446 observe->ScanForDevices(lib);
445 // Connect the chromeos notifications 447 // Connect the chromeos notifications
446 448
447 // This observer is a singleton. It is never deleted but the pointer is kept 449 // This observer is a singleton. It is never deleted but the pointer is kept
448 // in a static so that it isn't reported as a leak. 450 // in a static so that it isn't reported as a leak.
449 static chromeos::LowBatteryObserver* low_battery_observer = 451 static chromeos::LowBatteryObserver* low_battery_observer =
450 new chromeos::LowBatteryObserver(profile); 452 new chromeos::LowBatteryObserver(profile);
451 chromeos::CrosLibrary::Get()->GetPowerLibrary()->AddObserver( 453 chromeos::CrosLibrary::Get()->GetPowerLibrary()->AddObserver(
452 low_battery_observer); 454 low_battery_observer);
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 scoped_refptr<AutomationProviderClass> automation = 1093 scoped_refptr<AutomationProviderClass> automation =
1092 new AutomationProviderClass(profile); 1094 new AutomationProviderClass(profile);
1093 automation->ConnectToChannel(channel_id); 1095 automation->ConnectToChannel(channel_id);
1094 automation->SetExpectedTabCount(expected_tabs); 1096 automation->SetExpectedTabCount(expected_tabs);
1095 1097
1096 AutomationProviderList* list = 1098 AutomationProviderList* list =
1097 g_browser_process->InitAutomationProviderList(); 1099 g_browser_process->InitAutomationProviderList();
1098 DCHECK(list); 1100 DCHECK(list);
1099 list->AddProvider(automation); 1101 list->AddProvider(automation);
1100 } 1102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698