Chromium Code Reviews| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 #include "chrome/browser/search_engines/template_url.h" | 72 #include "chrome/browser/search_engines/template_url.h" |
| 73 #include "chrome/browser/search_engines/template_url_service.h" | 73 #include "chrome/browser/search_engines/template_url_service.h" |
| 74 #include "chrome/browser/search_engines/template_url_service_factory.h" | 74 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 75 #include "chrome/browser/service/service_process_control.h" | 75 #include "chrome/browser/service/service_process_control.h" |
| 76 #include "chrome/browser/shell_integration.h" | 76 #include "chrome/browser/shell_integration.h" |
| 77 #include "chrome/browser/translate/translate_manager.h" | 77 #include "chrome/browser/translate/translate_manager.h" |
| 78 #include "chrome/browser/ui/browser.h" | 78 #include "chrome/browser/ui/browser.h" |
| 79 #include "chrome/browser/ui/browser_init.h" | 79 #include "chrome/browser/ui/browser_init.h" |
| 80 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 80 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 81 #include "chrome/browser/ui/webui/sync_promo_trial.h" | 81 #include "chrome/browser/ui/webui/sync_promo_trial.h" |
| 82 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" | |
| 83 #include "chrome/common/child_process_logging.h" | 82 #include "chrome/common/child_process_logging.h" |
| 84 #include "chrome/common/chrome_constants.h" | 83 #include "chrome/common/chrome_constants.h" |
| 85 #include "chrome/common/chrome_paths.h" | 84 #include "chrome/common/chrome_paths.h" |
| 86 #include "chrome/common/chrome_result_codes.h" | 85 #include "chrome/common/chrome_result_codes.h" |
| 87 #include "chrome/common/chrome_switches.h" | 86 #include "chrome/common/chrome_switches.h" |
| 88 #include "chrome/common/chrome_version_info.h" | 87 #include "chrome/common/chrome_version_info.h" |
| 89 #include "chrome/common/env_vars.h" | 88 #include "chrome/common/env_vars.h" |
| 90 #include "chrome/common/json_pref_store.h" | 89 #include "chrome/common/json_pref_store.h" |
| 91 #include "chrome/common/jstemplate_builder.h" | 90 #include "chrome/common/jstemplate_builder.h" |
| 92 #include "chrome/common/logging_chrome.h" | 91 #include "chrome/common/logging_chrome.h" |
| 93 #include "chrome/common/net/net_resource_provider.h" | 92 #include "chrome/common/net/net_resource_provider.h" |
| 94 #include "chrome/common/pref_names.h" | 93 #include "chrome/common/pref_names.h" |
| 95 #include "chrome/common/profiling.h" | 94 #include "chrome/common/profiling.h" |
| 96 #include "chrome/installer/util/google_update_settings.h" | 95 #include "chrome/installer/util/google_update_settings.h" |
| 96 #include "content/browser/gpu/gpu_blacklist.h" | |
| 97 #include "content/browser/gpu/gpu_data_manager.h" | |
| 97 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 98 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 98 #include "content/public/browser/browser_thread.h" | 99 #include "content/public/browser/browser_thread.h" |
| 99 #include "content/public/common/content_client.h" | 100 #include "content/public/common/content_client.h" |
| 100 #include "content/public/common/main_function_params.h" | 101 #include "content/public/common/main_function_params.h" |
| 101 #include "grit/app_locale_settings.h" | 102 #include "grit/app_locale_settings.h" |
| 103 #include "grit/browser_resources.h" | |
| 102 #include "grit/chromium_strings.h" | 104 #include "grit/chromium_strings.h" |
| 103 #include "grit/generated_resources.h" | 105 #include "grit/generated_resources.h" |
| 104 #include "grit/platform_locale_settings.h" | 106 #include "grit/platform_locale_settings.h" |
| 105 #include "net/base/cookie_monster.h" | 107 #include "net/base/cookie_monster.h" |
| 106 #include "net/base/net_module.h" | 108 #include "net/base/net_module.h" |
| 107 #include "net/base/sdch_manager.h" | 109 #include "net/base/sdch_manager.h" |
| 108 #include "net/http/http_basic_stream.h" | 110 #include "net/http/http_basic_stream.h" |
| 109 #include "net/http/http_network_layer.h" | 111 #include "net/http/http_network_layer.h" |
| 110 #include "net/http/http_stream_factory.h" | 112 #include "net/http/http_stream_factory.h" |
| 111 #include "net/socket/client_socket_pool_base.h" | 113 #include "net/socket/client_socket_pool_base.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 #else | 426 #else |
| 425 // TODO(port): fix this. See comments near the definition of | 427 // TODO(port): fix this. See comments near the definition of |
| 426 // user_data_dir. It is better to CHECK-fail here than it is to | 428 // user_data_dir. It is better to CHECK-fail here than it is to |
| 427 // silently exit because of missing code in the above test. | 429 // silently exit because of missing code in the above test. |
| 428 CHECK(profile) << "Cannot get default profile."; | 430 CHECK(profile) << "Cannot get default profile."; |
| 429 #endif | 431 #endif |
| 430 | 432 |
| 431 return NULL; | 433 return NULL; |
| 432 } | 434 } |
| 433 | 435 |
| 436 // Load GPU Blacklist, collect preliminary gpu info, and compute preliminary | |
| 437 // gpu feature flags. | |
| 438 void InitializeGpuDataManager(const CommandLine& parsed_command_line) { | |
|
Ken Russell (switch to Gerrit)
2011/12/03 02:39:15
It seems to me that most of this logic would be be
| |
| 439 GpuDataManager::GetInstance(); | |
| 440 | |
| 441 if (parsed_command_line.HasSwitch(switches::kSkipGpuDataLoading)) | |
| 442 return; | |
| 443 | |
| 444 const base::StringPiece gpu_blacklist_json( | |
| 445 ResourceBundle::GetSharedInstance().GetRawDataResource( | |
| 446 IDR_GPU_BLACKLIST)); | |
| 447 chrome::VersionInfo version_info; | |
| 448 std::string chrome_version_string = | |
| 449 version_info.is_valid() ? version_info.Version() : "0"; | |
| 450 GpuBlacklist* gpu_blacklist = new GpuBlacklist(chrome_version_string); | |
| 451 bool succeed = gpu_blacklist->LoadGpuBlacklist( | |
| 452 gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); | |
| 453 DCHECK(succeed); | |
| 454 GpuDataManager::GetInstance()->SetGpuBlacklist(gpu_blacklist); | |
| 455 } | |
| 456 | |
| 434 #if defined(OS_MACOSX) | 457 #if defined(OS_MACOSX) |
| 435 OSStatus KeychainCallback(SecKeychainEvent keychain_event, | 458 OSStatus KeychainCallback(SecKeychainEvent keychain_event, |
| 436 SecKeychainCallbackInfo *info, void *context) { | 459 SecKeychainCallbackInfo *info, void *context) { |
| 437 return noErr; | 460 return noErr; |
| 438 } | 461 } |
| 439 #endif | 462 #endif |
| 440 | 463 |
| 441 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) | 464 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) |
| 442 void RegisterTranslateableItems(void) { | 465 void RegisterTranslateableItems(void) { |
| 443 struct { | 466 struct { |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1676 record_search_engine_ = is_first_run_ && !profile_->IsOffTheRecord(); | 1699 record_search_engine_ = is_first_run_ && !profile_->IsOffTheRecord(); |
| 1677 #endif | 1700 #endif |
| 1678 | 1701 |
| 1679 // Create the instance of the cloud print proxy service so that it can launch | 1702 // Create the instance of the cloud print proxy service so that it can launch |
| 1680 // the service process if needed. This is needed because the service process | 1703 // the service process if needed. This is needed because the service process |
| 1681 // might have shutdown because an update was available. | 1704 // might have shutdown because an update was available. |
| 1682 // TODO(torne): this should maybe be done with | 1705 // TODO(torne): this should maybe be done with |
| 1683 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? | 1706 // ProfileKeyedServiceFactory::ServiceIsCreatedWithProfile() instead? |
| 1684 CloudPrintProxyServiceFactory::GetForProfile(profile_); | 1707 CloudPrintProxyServiceFactory::GetForProfile(profile_); |
| 1685 | 1708 |
| 1686 // Initialize GpuDataManager and collect preliminary gpu info. | 1709 // Load GPU Blacklist. |
| 1687 GpuBlacklistUpdater::Setup(); | 1710 InitializeGpuDataManager(parsed_command_line()); |
| 1688 | 1711 |
| 1689 // Start watching all browser threads for responsiveness. | 1712 // Start watching all browser threads for responsiveness. |
| 1690 ThreadWatcherList::StartWatchingAll(parsed_command_line()); | 1713 ThreadWatcherList::StartWatchingAll(parsed_command_line()); |
| 1691 | 1714 |
| 1692 #if !defined(DISABLE_NACL) | 1715 #if !defined(DISABLE_NACL) |
| 1693 NaClProcessHost::EarlyStartup(); | 1716 NaClProcessHost::EarlyStartup(); |
| 1694 #endif | 1717 #endif |
| 1695 | 1718 |
| 1696 PreBrowserStart(); | 1719 PreBrowserStart(); |
| 1697 | 1720 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1929 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 1952 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
| 1930 (pre_read == "0" || pre_read == "1")) { | 1953 (pre_read == "0" || pre_read == "1")) { |
| 1931 std::string uma_name(name); | 1954 std::string uma_name(name); |
| 1932 uma_name += "_PreRead"; | 1955 uma_name += "_PreRead"; |
| 1933 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 1956 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
| 1934 AddPreReadHistogramTime(uma_name.c_str(), time); | 1957 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1935 } | 1958 } |
| 1936 #endif | 1959 #endif |
| 1937 #endif | 1960 #endif |
| 1938 } | 1961 } |
| OLD | NEW |