OLD | NEW |
---|---|
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/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 #include "chromeos/cryptohome/async_method_caller.h" | 79 #include "chromeos/cryptohome/async_method_caller.h" |
80 #include "chromeos/dbus/dbus_thread_manager.h" | 80 #include "chromeos/dbus/dbus_thread_manager.h" |
81 #include "chromeos/dbus/power_manager_client.h" | 81 #include "chromeos/dbus/power_manager_client.h" |
82 #include "chromeos/dbus/session_manager_client.h" | 82 #include "chromeos/dbus/session_manager_client.h" |
83 #include "chromeos/disks/disk_mount_manager.h" | 83 #include "chromeos/disks/disk_mount_manager.h" |
84 #include "chromeos/display/output_configurator.h" | 84 #include "chromeos/display/output_configurator.h" |
85 #include "chromeos/network/network_event_log.h" | 85 #include "chromeos/network/network_event_log.h" |
86 #include "chromeos/network/network_state_handler.h" | 86 #include "chromeos/network/network_state_handler.h" |
87 #include "chromeos/power/power_state_override.h" | 87 #include "chromeos/power/power_state_override.h" |
88 #include "content/public/browser/notification_service.h" | 88 #include "content/public/browser/notification_service.h" |
89 #include "content/public/common/content_switches.h" | |
89 #include "content/public/common/main_function_params.h" | 90 #include "content/public/common/main_function_params.h" |
90 #include "grit/platform_locale_settings.h" | 91 #include "grit/platform_locale_settings.h" |
91 #include "net/base/network_change_notifier.h" | 92 #include "net/base/network_change_notifier.h" |
92 #include "net/url_request/url_request.h" | 93 #include "net/url_request/url_request.h" |
93 | 94 |
94 namespace chromeos { | 95 namespace chromeos { |
95 | 96 |
96 namespace { | 97 namespace { |
97 | 98 |
98 class MessageLoopObserver : public MessageLoopForUI::Observer { | 99 class MessageLoopObserver : public MessageLoopForUI::Observer { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 LoginUtils::Get()->DoBrowserLaunch(profile, NULL); | 163 LoginUtils::Get()->DoBrowserLaunch(profile, NULL); |
163 if (!pending_requests_) | 164 if (!pending_requests_) |
164 delete this; | 165 delete this; |
165 } | 166 } |
166 | 167 |
167 scoped_refptr<Authenticator> authenticator_; | 168 scoped_refptr<Authenticator> authenticator_; |
168 bool pending_requests_; | 169 bool pending_requests_; |
169 bool profile_prepared_; | 170 bool profile_prepared_; |
170 }; | 171 }; |
171 | 172 |
173 void LaunchDevToolsHandlerIfNeeded(Profile* profile, | |
174 const CommandLine& command_line) { | |
175 if (command_line.HasSwitch(::switches::kRemoteDebuggingPort)) { | |
176 std::string port_str = | |
177 command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort); | |
178 int64 port; | |
179 if (base::StringToInt64(port_str, &port) && port > 0 && port < 65535) { | |
sky
2012/12/04 00:10:53
Use StringToInt (avoids cast on 188).
zel
2012/12/04 02:12:28
Done.
| |
180 std::string frontend_str; | |
181 if (command_line.HasSwitch(::switches::kRemoteDebuggingFrontend)) { | |
182 frontend_str = command_line.GetSwitchValueASCII( | |
183 ::switches::kRemoteDebuggingFrontend); | |
184 } | |
185 g_browser_process->CreateDevToolsHttpProtocolHandler( | |
186 profile, | |
187 "127.0.0.1", | |
188 static_cast<int>(port), | |
189 frontend_str); | |
190 } else { | |
191 DLOG(WARNING) << "Invalid http debugger port number " << port; | |
192 } | |
193 } | |
194 } | |
195 | |
172 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line, | 196 void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line, |
173 Profile* profile) { | 197 Profile* profile) { |
174 if (parsed_command_line.HasSwitch(::switches::kLoginManager)) { | 198 if (parsed_command_line.HasSwitch(::switches::kLoginManager)) { |
175 std::string first_screen = | 199 std::string first_screen = |
176 parsed_command_line.GetSwitchValueASCII(::switches::kLoginScreen); | 200 parsed_command_line.GetSwitchValueASCII(::switches::kLoginScreen); |
177 std::string size_arg = | 201 std::string size_arg = |
178 parsed_command_line.GetSwitchValueASCII( | 202 parsed_command_line.GetSwitchValueASCII( |
179 ::switches::kLoginScreenSize); | 203 ::switches::kLoginScreenSize); |
180 gfx::Size size(0, 0); | 204 gfx::Size size(0, 0); |
181 // Allow the size of the login window to be set explicitly. If not set, | 205 // Allow the size of the login window to be set explicitly. If not set, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 const PrefService::Preference* use_shared_proxies_pref = | 520 const PrefService::Preference* use_shared_proxies_pref = |
497 profile()->GetPrefs()->FindPreference(prefs::kUseSharedProxies); | 521 profile()->GetPrefs()->FindPreference(prefs::kUseSharedProxies); |
498 if (use_shared_proxies_pref->IsDefaultValue()) | 522 if (use_shared_proxies_pref->IsDefaultValue()) |
499 profile()->GetPrefs()->SetBoolean(prefs::kUseSharedProxies, false); | 523 profile()->GetPrefs()->SetBoolean(prefs::kUseSharedProxies, false); |
500 } | 524 } |
501 | 525 |
502 // Make sure the NetworkConfigurationUpdater is ready so that it pushes ONC | 526 // Make sure the NetworkConfigurationUpdater is ready so that it pushes ONC |
503 // configuration before login. | 527 // configuration before login. |
504 connector->GetNetworkConfigurationUpdater(); | 528 connector->GetNetworkConfigurationUpdater(); |
505 | 529 |
506 // Make sure that wallpaper boot transition and other delays in OOBE | 530 if (parsed_command_line().HasSwitch(::switches::kTestType)) { |
507 // are disabled for tests by default. | 531 // Make sure that wallpaper boot transition and other delays in OOBE |
508 // Individual tests may enable them if they want. | 532 // are disabled for tests by default. |
509 if (parsed_command_line().HasSwitch(::switches::kTestType)) | 533 // Individual tests may enable them if they want. |
510 WizardController::SetZeroDelays(); | 534 WizardController::SetZeroDelays(); |
535 } | |
536 | |
537 // Start dev tools protocol handler. | |
538 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); | |
511 | 539 |
512 // Tests should be able to tune login manager before showing it. | 540 // Tests should be able to tune login manager before showing it. |
513 // Thus only show login manager in normal (non-testing) mode. | 541 // Thus only show login manager in normal (non-testing) mode. |
514 if (!parameters().ui_task) | 542 if (!parameters().ui_task) |
515 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); | 543 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); |
516 | 544 |
517 // These observers must be initialized after the profile because | 545 // These observers must be initialized after the profile because |
518 // they use the profile to dispatch extension events. | 546 // they use the profile to dispatch extension events. |
519 // | 547 // |
520 // Initialize the brightness observer so that we'll display an onscreen | 548 // Initialize the brightness observer so that we'll display an onscreen |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
702 } else if (trial->group() == margin_200mb) { | 730 } else if (trial->group() == margin_200mb) { |
703 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; | 731 LOG(WARNING) << "low_mem: Part of '200MB' experiment"; |
704 LowMemoryObserver::SetLowMemoryMargin(200); | 732 LowMemoryObserver::SetLowMemoryMargin(200); |
705 } else { | 733 } else { |
706 LOG(WARNING) << "low_mem: Part of 'default' experiment"; | 734 LOG(WARNING) << "low_mem: Part of 'default' experiment"; |
707 } | 735 } |
708 } | 736 } |
709 } | 737 } |
710 | 738 |
711 } // namespace chromeos | 739 } // namespace chromeos |
OLD | NEW |