Chromium Code Reviews| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 #include "chrome/common/jstemplate_builder.h" | 97 #include "chrome/common/jstemplate_builder.h" |
| 98 #include "chrome/common/logging_chrome.h" | 98 #include "chrome/common/logging_chrome.h" |
| 99 #include "chrome/common/metrics/variations/variations_util.h" | 99 #include "chrome/common/metrics/variations/variations_util.h" |
| 100 #include "chrome/common/net/net_resource_provider.h" | 100 #include "chrome/common/net/net_resource_provider.h" |
| 101 #include "chrome/common/pref_names.h" | 101 #include "chrome/common/pref_names.h" |
| 102 #include "chrome/common/profiling.h" | 102 #include "chrome/common/profiling.h" |
| 103 #include "chrome/common/startup_metric_utils.h" | 103 #include "chrome/common/startup_metric_utils.h" |
| 104 #include "chrome/installer/util/google_update_settings.h" | 104 #include "chrome/installer/util/google_update_settings.h" |
| 105 #include "content/public/browser/browser_thread.h" | 105 #include "content/public/browser/browser_thread.h" |
| 106 #include "content/public/common/content_client.h" | 106 #include "content/public/common/content_client.h" |
| 107 #include "content/public/common/content_switches.h" | |
| 107 #include "content/public/common/main_function_params.h" | 108 #include "content/public/common/main_function_params.h" |
| 108 #include "grit/app_locale_settings.h" | 109 #include "grit/app_locale_settings.h" |
| 109 #include "grit/browser_resources.h" | 110 #include "grit/browser_resources.h" |
| 110 #include "grit/chromium_strings.h" | 111 #include "grit/chromium_strings.h" |
| 111 #include "grit/generated_resources.h" | 112 #include "grit/generated_resources.h" |
| 112 #include "grit/platform_locale_settings.h" | 113 #include "grit/platform_locale_settings.h" |
| 113 #include "net/base/net_module.h" | 114 #include "net/base/net_module.h" |
| 114 #include "net/base/sdch_manager.h" | 115 #include "net/base/sdch_manager.h" |
| 115 #include "net/cookies/cookie_monster.h" | 116 #include "net/cookies/cookie_monster.h" |
| 116 #include "net/http/http_network_layer.h" | 117 #include "net/http/http_network_layer.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( | 413 StartupBrowserCreator::ProcessCommandLineAlreadyRunning( |
| 413 command_line, current_directory); | 414 command_line, current_directory); |
| 414 return true; | 415 return true; |
| 415 } | 416 } |
| 416 | 417 |
| 417 bool HasImportSwitch(const CommandLine& command_line) { | 418 bool HasImportSwitch(const CommandLine& command_line) { |
| 418 return (command_line.HasSwitch(switches::kImport) || | 419 return (command_line.HasSwitch(switches::kImport) || |
| 419 command_line.HasSwitch(switches::kImportFromFile)); | 420 command_line.HasSwitch(switches::kImportFromFile)); |
| 420 } | 421 } |
| 421 | 422 |
| 423 void LaunchDevToolsHandlerIfNeeded(Profile* profile, | |
| 424 const CommandLine& command_line) { | |
| 425 if (command_line.HasSwitch(::switches::kRemoteDebuggingPort)) { | |
| 426 std::string port_str = | |
| 427 command_line.GetSwitchValueASCII(::switches::kRemoteDebuggingPort); | |
| 428 int port; | |
| 429 if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { | |
| 430 std::string frontend_str; | |
| 431 if (command_line.HasSwitch(::switches::kRemoteDebuggingFrontend)) { | |
| 432 frontend_str = command_line.GetSwitchValueASCII( | |
| 433 ::switches::kRemoteDebuggingFrontend); | |
| 434 } | |
| 435 g_browser_process->CreateDevToolsHttpProtocolHandler( | |
| 436 profile, | |
| 437 "127.0.0.1", | |
| 438 port, | |
| 439 frontend_str); | |
| 440 } else { | |
| 441 DLOG(WARNING) << "Invalid http debugger port number " << port; | |
| 442 } | |
| 443 } | |
| 444 } | |
| 445 | |
| 422 #if defined(ENABLE_RLZ) | 446 #if defined(ENABLE_RLZ) |
| 423 bool IsGoogleUrl(const GURL& url) { | 447 bool IsGoogleUrl(const GURL& url) { |
| 424 return google_util::IsGoogleHomePageUrl(url.possibly_invalid_spec()); | 448 return google_util::IsGoogleHomePageUrl(url.possibly_invalid_spec()); |
| 425 } | 449 } |
| 426 #endif | 450 #endif |
| 427 | 451 |
| 428 } // namespace | 452 } // namespace |
| 429 | 453 |
| 430 namespace chrome_browser { | 454 namespace chrome_browser { |
| 431 // This error message is not localized because we failed to load the | 455 // This error message is not localized because we failed to load the |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 854 // PreBrowserStart() | 878 // PreBrowserStart() |
| 855 // ... browser_creator_->Start (OR parameters().ui_task->Run()) | 879 // ... browser_creator_->Start (OR parameters().ui_task->Run()) |
| 856 // PostBrowserStart() | 880 // PostBrowserStart() |
| 857 | 881 |
| 858 void ChromeBrowserMainParts::PreProfileInit() { | 882 void ChromeBrowserMainParts::PreProfileInit() { |
| 859 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 883 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 860 chrome_extra_parts_[i]->PreProfileInit(); | 884 chrome_extra_parts_[i]->PreProfileInit(); |
| 861 } | 885 } |
| 862 | 886 |
| 863 void ChromeBrowserMainParts::PostProfileInit() { | 887 void ChromeBrowserMainParts::PostProfileInit() { |
| 888 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); | |
|
Nikita (slow)
2012/12/05 14:06:04
This part isn't reached on ChromeOS build.
#0 ch
stevenjb
2012/12/05 17:35:23
Yikes! Good thing that (until now) PostProfileInit
| |
| 864 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 889 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 865 chrome_extra_parts_[i]->PostProfileInit(); | 890 chrome_extra_parts_[i]->PostProfileInit(); |
| 866 } | 891 } |
| 867 | 892 |
| 868 void ChromeBrowserMainParts::PreInteractiveFirstRunInit() { | 893 void ChromeBrowserMainParts::PreInteractiveFirstRunInit() { |
| 869 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 894 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 870 chrome_extra_parts_[i]->PreInteractiveFirstRunInit(); | 895 chrome_extra_parts_[i]->PreInteractiveFirstRunInit(); |
| 871 } | 896 } |
| 872 | 897 |
| 873 void ChromeBrowserMainParts::PostInteractiveFirstRunInit() { | 898 void ChromeBrowserMainParts::PostInteractiveFirstRunInit() { |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1650 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1675 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1651 uma_name += "_XP"; | 1676 uma_name += "_XP"; |
| 1652 | 1677 |
| 1653 uma_name += "_PreRead_"; | 1678 uma_name += "_PreRead_"; |
| 1654 uma_name += pre_read_percentage; | 1679 uma_name += pre_read_percentage; |
| 1655 AddPreReadHistogramTime(uma_name.c_str(), time); | 1680 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1656 } | 1681 } |
| 1657 #endif | 1682 #endif |
| 1658 #endif | 1683 #endif |
| 1659 } | 1684 } |
| OLD | NEW |