OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/event_recorder.h" | 10 #include "base/event_recorder.h" |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 if (process_startup) { | 533 if (process_startup) { |
534 // NetworkStateNotifier has to be initialized before Launching browser | 534 // NetworkStateNotifier has to be initialized before Launching browser |
535 // because the page load can happen in parallel to this UI thread | 535 // because the page load can happen in parallel to this UI thread |
536 // and IO thread may access the NetworkStateNotifier. | 536 // and IO thread may access the NetworkStateNotifier. |
537 chromeos::CrosLibrary::Get()->GetNetworkLibrary() | 537 chromeos::CrosLibrary::Get()->GetNetworkLibrary() |
538 ->AddNetworkManagerObserver( | 538 ->AddNetworkManagerObserver( |
539 chromeos::NetworkStateNotifier::GetInstance()); | 539 chromeos::NetworkStateNotifier::GetInstance()); |
540 } | 540 } |
541 #endif | 541 #endif |
542 | 542 |
543 // Continue with the off-the-record profile from here on if --incognito | 543 // Continue with the incognito profile from here on if --incognito |
544 if (command_line.HasSwitch(switches::kIncognito) && | 544 if (command_line.HasSwitch(switches::kIncognito) && |
545 profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) { | 545 profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) { |
546 profile = profile->GetOffTheRecordProfile(); | 546 profile = profile->GetOffTheRecordProfile(); |
547 } | 547 } |
548 | 548 |
549 BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this); | 549 BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this); |
550 std::vector<GURL> urls_to_launch = BrowserInit::GetURLsFromCommandLine( | 550 std::vector<GURL> urls_to_launch = BrowserInit::GetURLsFromCommandLine( |
551 command_line, cur_dir, profile); | 551 command_line, cur_dir, profile); |
552 bool launched = lwp.Launch(profile, urls_to_launch, process_startup); | 552 bool launched = lwp.Launch(profile, urls_to_launch, process_startup); |
553 in_startup = false; | 553 in_startup = false; |
554 | 554 |
555 if (!launched) { | 555 if (!launched) { |
556 LOG(ERROR) << "launch error"; | 556 LOG(ERROR) << "launch error"; |
557 if (return_code) | 557 if (return_code) |
558 *return_code = ResultCodes::INVALID_CMDLINE_URL; | 558 *return_code = ResultCodes::INVALID_CMDLINE_URL; |
559 return false; | 559 return false; |
560 } | 560 } |
561 | 561 |
562 #if defined(OS_CHROMEOS) | 562 #if defined(OS_CHROMEOS) |
563 // Initialize Chrome OS preferences like touch pad sensitivity. For the | 563 // Initialize Chrome OS preferences like touch pad sensitivity. For the |
564 // preferences to work in the guest mode, the initialization has to be | 564 // preferences to work in the guest mode, the initialization has to be |
565 // done after |profile| is switched to the off-the-record profile (which | 565 // done after |profile| is switched to the incognito profile (which |
566 // is actually GuestSessionProfile in the guest mode). See the | 566 // is actually GuestSessionProfile in the guest mode). See the |
567 // GetOffTheRecordProfile() call above. | 567 // GetOffTheRecordProfile() call above. |
568 profile->InitChromeOSPreferences(); | 568 profile->InitChromeOSPreferences(); |
569 | 569 |
570 // Create the WmMessageListener so that it can listen for messages regardless | 570 // Create the WmMessageListener so that it can listen for messages regardless |
571 // of what window has focus. | 571 // of what window has focus. |
572 chromeos::WmMessageListener::GetInstance(); | 572 chromeos::WmMessageListener::GetInstance(); |
573 | 573 |
574 // Create the SystemKeyEventListener so it can listen for system keyboard | 574 // Create the SystemKeyEventListener so it can listen for system keyboard |
575 // messages regardless of focus. | 575 // messages regardless of focus. |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 return false; | 1380 return false; |
1381 automation->SetExpectedTabCount(expected_tabs); | 1381 automation->SetExpectedTabCount(expected_tabs); |
1382 | 1382 |
1383 AutomationProviderList* list = | 1383 AutomationProviderList* list = |
1384 g_browser_process->InitAutomationProviderList(); | 1384 g_browser_process->InitAutomationProviderList(); |
1385 DCHECK(list); | 1385 DCHECK(list); |
1386 list->AddProvider(automation); | 1386 list->AddProvider(automation); |
1387 | 1387 |
1388 return true; | 1388 return true; |
1389 } | 1389 } |
OLD | NEW |