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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 10392007: Restoring the chrome variatioons client, with a fix for browser_test failures caused by it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months 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) 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/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/download/download_request_limiter.h" 29 #include "chrome/browser/download/download_request_limiter.h"
30 #include "chrome/browser/download/download_status_updater.h" 30 #include "chrome/browser/download/download_status_updater.h"
31 #include "chrome/browser/extensions/extension_event_router_forwarder.h" 31 #include "chrome/browser/extensions/extension_event_router_forwarder.h"
32 #include "chrome/browser/extensions/extension_tab_id_map.h" 32 #include "chrome/browser/extensions/extension_tab_id_map.h"
33 #include "chrome/browser/first_run/upgrade_util.h" 33 #include "chrome/browser/first_run/upgrade_util.h"
34 #include "chrome/browser/icon_manager.h" 34 #include "chrome/browser/icon_manager.h"
35 #include "chrome/browser/intranet_redirect_detector.h" 35 #include "chrome/browser/intranet_redirect_detector.h"
36 #include "chrome/browser/io_thread.h" 36 #include "chrome/browser/io_thread.h"
37 #include "chrome/browser/metrics/metrics_service.h" 37 #include "chrome/browser/metrics/metrics_service.h"
38 #include "chrome/browser/metrics/thread_watcher.h" 38 #include "chrome/browser/metrics/thread_watcher.h"
39 #include "chrome/browser/metrics/variations_service.h"
39 #include "chrome/browser/net/chrome_net_log.h" 40 #include "chrome/browser/net/chrome_net_log.h"
40 #include "chrome/browser/net/crl_set_fetcher.h" 41 #include "chrome/browser/net/crl_set_fetcher.h"
41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 42 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
42 #include "chrome/browser/notifications/notification_ui_manager.h" 43 #include "chrome/browser/notifications/notification_ui_manager.h"
43 #include "chrome/browser/policy/browser_policy_connector.h" 44 #include "chrome/browser/policy/browser_policy_connector.h"
44 #include "chrome/browser/policy/policy_service_impl.h" 45 #include "chrome/browser/policy/policy_service_impl.h"
45 #include "chrome/browser/policy/policy_service_stub.h" 46 #include "chrome/browser/policy/policy_service_stub.h"
46 #include "chrome/browser/prefs/browser_prefs.h" 47 #include "chrome/browser/prefs/browser_prefs.h"
47 #include "chrome/browser/prefs/pref_service.h" 48 #include "chrome/browser/prefs/pref_service.h"
48 #include "chrome/browser/prerender/prerender_tracker.h" 49 #include "chrome/browser/prerender/prerender_tracker.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 using content::PluginService; 122 using content::PluginService;
122 using content::ResourceDispatcherHost; 123 using content::ResourceDispatcherHost;
123 124
124 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) 125 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
125 : created_metrics_service_(false), 126 : created_metrics_service_(false),
126 created_watchdog_thread_(false), 127 created_watchdog_thread_(false),
127 created_profile_manager_(false), 128 created_profile_manager_(false),
128 created_local_state_(false), 129 created_local_state_(false),
129 created_icon_manager_(false), 130 created_icon_manager_(false),
130 created_browser_policy_connector_(false), 131 created_browser_policy_connector_(false),
132 created_variations_service_(false),
131 created_notification_ui_manager_(false), 133 created_notification_ui_manager_(false),
132 created_safe_browsing_service_(false), 134 created_safe_browsing_service_(false),
133 module_ref_count_(0), 135 module_ref_count_(0),
134 did_start_(false), 136 did_start_(false),
135 checked_for_new_frames_(false), 137 checked_for_new_frames_(false),
136 using_new_frames_(false), 138 using_new_frames_(false),
137 thumbnail_generator_(new ThumbnailGenerator), 139 thumbnail_generator_(new ThumbnailGenerator),
138 download_status_updater_(new DownloadStatusUpdater) { 140 download_status_updater_(new DownloadStatusUpdater) {
139 g_browser_process = this; 141 g_browser_process = this;
140 clipboard_.reset(new ui::Clipboard); 142 clipboard_.reset(new ui::Clipboard);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 automation_provider_list_.reset(); 180 automation_provider_list_.reset();
179 #endif 181 #endif
180 182
181 // We need to shutdown the SdchDictionaryFetcher as it regularly holds 183 // We need to shutdown the SdchDictionaryFetcher as it regularly holds
182 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do 184 // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do
183 // a PostDelayedTask onto the IO thread. This shutdown call will both discard 185 // a PostDelayedTask onto the IO thread. This shutdown call will both discard
184 // any pending URLFetchers, and avoid creating any more. 186 // any pending URLFetchers, and avoid creating any more.
185 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 187 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
186 base::Bind(&SdchDictionaryFetcher::Shutdown)); 188 base::Bind(&SdchDictionaryFetcher::Shutdown));
187 189
188 // We need to destroy the MetricsService, IntranetRedirectDetector, and 190 // We need to destroy the MetricsService, VariationsService,
189 // SafeBrowsing ClientSideDetectionService (owned by the SafeBrowsingService) 191 // IntranetRedirectDetector, and SafeBrowsing ClientSideDetectionService
190 // before the io_thread_ gets destroyed, since their destructors can call the 192 // (owned by the SafeBrowsingService) before the io_thread_ gets destroyed,
191 // URLFetcher destructor, which does a PostDelayedTask operation on the IO 193 // since their destructors can call the URLFetcher destructor, which does a
192 // thread. (The IO thread will handle that URLFetcher operation before going 194 // PostDelayedTask operation on the IO thread. (The IO thread will handle that
193 // away.) 195 // URLFetcher operation before going away.)
194 metrics_service_.reset(); 196 metrics_service_.reset();
197 variations_service_.reset();
195 intranet_redirect_detector_.reset(); 198 intranet_redirect_detector_.reset();
196 #if defined(ENABLE_SAFE_BROWSING) 199 #if defined(ENABLE_SAFE_BROWSING)
197 if (safe_browsing_service_.get()) { 200 if (safe_browsing_service_.get()) {
198 safe_browsing_service()->ShutDown(); 201 safe_browsing_service()->ShutDown();
199 } 202 }
200 #endif 203 #endif
201 204
202 // Need to clear the desktop notification balloons before the io_thread_ and 205 // Need to clear the desktop notification balloons before the io_thread_ and
203 // before the profiles, since if there are any still showing we will access 206 // before the profiles, since if there are any still showing we will access
204 // those things during teardown. 207 // those things during teardown.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 ui::Clipboard* BrowserProcessImpl::clipboard() { 391 ui::Clipboard* BrowserProcessImpl::clipboard() {
389 DCHECK(CalledOnValidThread()); 392 DCHECK(CalledOnValidThread());
390 return clipboard_.get(); 393 return clipboard_.get();
391 } 394 }
392 395
393 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { 396 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() {
394 DCHECK(CalledOnValidThread()); 397 DCHECK(CalledOnValidThread());
395 return io_thread()->system_url_request_context_getter(); 398 return io_thread()->system_url_request_context_getter();
396 } 399 }
397 400
401 VariationsService* BrowserProcessImpl::variations_service() {
402 DCHECK(CalledOnValidThread());
403 if (!created_variations_service_)
404 CreateVariationsService();
405 return variations_service_.get();
406 }
407
398 #if defined(OS_CHROMEOS) 408 #if defined(OS_CHROMEOS)
399 chromeos::OomPriorityManager* BrowserProcessImpl::oom_priority_manager() { 409 chromeos::OomPriorityManager* BrowserProcessImpl::oom_priority_manager() {
400 DCHECK(CalledOnValidThread()); 410 DCHECK(CalledOnValidThread());
401 if (!oom_priority_manager_.get()) 411 if (!oom_priority_manager_.get())
402 oom_priority_manager_.reset(new chromeos::OomPriorityManager()); 412 oom_priority_manager_.reset(new chromeos::OomPriorityManager());
403 return oom_priority_manager_.get(); 413 return oom_priority_manager_.get();
404 } 414 }
405 #endif // defined(OS_CHROMEOS) 415 #endif // defined(OS_CHROMEOS)
406 416
407 ExtensionEventRouterForwarder* 417 ExtensionEventRouterForwarder*
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 741
732 // This is observed by ChildProcessSecurityPolicy, which lives in content/ 742 // This is observed by ChildProcessSecurityPolicy, which lives in content/
733 // though, so it can't register itself. 743 // though, so it can't register itself.
734 local_state_->RegisterListPref(prefs::kDisabledSchemes); 744 local_state_->RegisterListPref(prefs::kDisabledSchemes);
735 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); 745 pref_change_registrar_.Add(prefs::kDisabledSchemes, this);
736 ApplyDisabledSchemesPolicy(); 746 ApplyDisabledSchemesPolicy();
737 747
738 local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); 748 local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false);
739 } 749 }
740 750
751 void BrowserProcessImpl::CreateVariationsService() {
752 DCHECK(!created_variations_service_ && variations_service_.get() == NULL);
753 created_variations_service_ = true;
754
755 variations_service_.reset(new VariationsService);
756 }
757
741 void BrowserProcessImpl::PreCreateThreads() { 758 void BrowserProcessImpl::PreCreateThreads() {
742 io_thread_.reset(new IOThread( 759 io_thread_.reset(new IOThread(
743 local_state(), net_log_.get(), extension_event_router_forwarder_.get())); 760 local_state(), net_log_.get(), extension_event_router_forwarder_.get()));
744 } 761 }
745 762
746 void BrowserProcessImpl::PreMainMessageLoopRun() { 763 void BrowserProcessImpl::PreMainMessageLoopRun() {
747 PluginService* plugin_service = PluginService::GetInstance(); 764 PluginService* plugin_service = PluginService::GetInstance();
748 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance()); 765 plugin_service->SetFilter(ChromePluginServiceFilter::GetInstance());
749 plugin_service->StartWatchingPlugins(); 766 plugin_service->StartWatchingPlugins();
750 767
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 } 933 }
917 934
918 void BrowserProcessImpl::OnAutoupdateTimer() { 935 void BrowserProcessImpl::OnAutoupdateTimer() {
919 if (CanAutorestartForUpdate()) { 936 if (CanAutorestartForUpdate()) {
920 DLOG(WARNING) << "Detected update. Restarting browser."; 937 DLOG(WARNING) << "Detected update. Restarting browser.";
921 RestartBackgroundInstance(); 938 RestartBackgroundInstance();
922 } 939 }
923 } 940 }
924 941
925 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 942 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698