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/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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "chrome/browser/metrics/metrics_service.h" | 42 #include "chrome/browser/metrics/metrics_service.h" |
| 43 #include "chrome/browser/metrics/thread_watcher.h" | 43 #include "chrome/browser/metrics/thread_watcher.h" |
| 44 #include "chrome/browser/metrics/variations/variations_service.h" | 44 #include "chrome/browser/metrics/variations/variations_service.h" |
| 45 #include "chrome/browser/net/chrome_net_log.h" | 45 #include "chrome/browser/net/chrome_net_log.h" |
| 46 #include "chrome/browser/net/crl_set_fetcher.h" | 46 #include "chrome/browser/net/crl_set_fetcher.h" |
| 47 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 47 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 48 #include "chrome/browser/notifications/notification_ui_manager.h" | 48 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 49 #include "chrome/browser/plugins/plugin_finder.h" | 49 #include "chrome/browser/plugins/plugin_finder.h" |
| 50 #include "chrome/browser/policy/policy_service.h" | 50 #include "chrome/browser/policy/policy_service.h" |
| 51 #include "chrome/browser/prefs/browser_prefs.h" | 51 #include "chrome/browser/prefs/browser_prefs.h" |
| 52 #include "chrome/browser/prefs/chrome_pref_service_builder.h" | 52 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 53 #include "chrome/browser/prefs/pref_service.h" | 53 #include "chrome/browser/prefs/pref_service.h" |
| 54 #include "chrome/browser/prerender/prerender_tracker.h" | 54 #include "chrome/browser/prerender/prerender_tracker.h" |
| 55 #include "chrome/browser/printing/background_printing_manager.h" | 55 #include "chrome/browser/printing/background_printing_manager.h" |
| 56 #include "chrome/browser/printing/print_job_manager.h" | 56 #include "chrome/browser/printing/print_job_manager.h" |
| 57 #include "chrome/browser/printing/print_preview_tab_controller.h" | 57 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 58 #include "chrome/browser/profiles/profile_manager.h" | 58 #include "chrome/browser/profiles/profile_manager.h" |
| 59 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 59 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
| 60 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 60 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 61 #include "chrome/browser/shell_integration.h" | 61 #include "chrome/browser/shell_integration.h" |
| 62 #include "chrome/browser/status_icons/status_tray.h" | 62 #include "chrome/browser/status_icons/status_tray.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 return watchdog_thread_.get(); | 393 return watchdog_thread_.get(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 ProfileManager* BrowserProcessImpl::profile_manager() { | 396 ProfileManager* BrowserProcessImpl::profile_manager() { |
| 397 DCHECK(CalledOnValidThread()); | 397 DCHECK(CalledOnValidThread()); |
| 398 if (!created_profile_manager_) | 398 if (!created_profile_manager_) |
| 399 CreateProfileManager(); | 399 CreateProfileManager(); |
| 400 return profile_manager_.get(); | 400 return profile_manager_.get(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 PrefService* BrowserProcessImpl::local_state() { | 403 PrefServiceSimple* BrowserProcessImpl::local_state() { |
|
Mattias Nissler (ping if slow)
2012/12/19 19:50:22
Is there any reason why we can't return PrefServic
Jói
2012/12/20 16:30:31
I think we could do that, have added a TODO to swi
Mattias Nissler (ping if slow)
2012/12/21 13:09:31
I guess I got confused by naming and which is livi
| |
| 404 DCHECK(CalledOnValidThread()); | 404 DCHECK(CalledOnValidThread()); |
| 405 if (!created_local_state_) | 405 if (!created_local_state_) |
| 406 CreateLocalState(); | 406 CreateLocalState(); |
| 407 return local_state_.get(); | 407 return local_state_.get(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { | 410 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { |
| 411 DCHECK(CalledOnValidThread()); | 411 DCHECK(CalledOnValidThread()); |
| 412 return io_thread()->system_url_request_context_getter(); | 412 return io_thread()->system_url_request_context_getter(); |
| 413 } | 413 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 profile_manager_.reset(new ProfileManager(user_data_dir)); | 728 profile_manager_.reset(new ProfileManager(user_data_dir)); |
| 729 } | 729 } |
| 730 | 730 |
| 731 void BrowserProcessImpl::CreateLocalState() { | 731 void BrowserProcessImpl::CreateLocalState() { |
| 732 DCHECK(!created_local_state_ && local_state_.get() == NULL); | 732 DCHECK(!created_local_state_ && local_state_.get() == NULL); |
| 733 created_local_state_ = true; | 733 created_local_state_ = true; |
| 734 | 734 |
| 735 FilePath local_state_path; | 735 FilePath local_state_path; |
| 736 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); | 736 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); |
| 737 local_state_.reset( | 737 local_state_.reset( |
| 738 ChromePrefServiceBuilder().CreateChromePrefs(local_state_path, | 738 ChromePrefServiceFactory().CreateLocalState(local_state_path, |
| 739 local_state_task_runner_, | 739 local_state_task_runner_, |
| 740 policy_service(), | 740 policy_service(), |
| 741 NULL, false)); | 741 NULL, false)); |
| 742 | 742 |
| 743 // Initialize the prefs of the local state. | 743 // Initialize the prefs of the local state. |
| 744 chrome::RegisterLocalState(local_state_.get()); | 744 chrome::RegisterLocalState(local_state_.get()); |
| 745 | 745 |
| 746 pref_change_registrar_.Init(local_state_.get()); | 746 pref_change_registrar_.Init(local_state_.get()); |
| 747 | 747 |
| 748 // Initialize the notification for the default browser setting policy. | 748 // Initialize the notification for the default browser setting policy. |
| 749 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 749 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
| 750 false); | 750 false); |
| 751 pref_change_registrar_.Add( | 751 pref_change_registrar_.Add( |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 976 } | 976 } |
| 977 | 977 |
| 978 void BrowserProcessImpl::OnAutoupdateTimer() { | 978 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 979 if (CanAutorestartForUpdate()) { | 979 if (CanAutorestartForUpdate()) { |
| 980 DLOG(WARNING) << "Detected update. Restarting browser."; | 980 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 981 RestartBackgroundInstance(); | 981 RestartBackgroundInstance(); |
| 982 } | 982 } |
| 983 } | 983 } |
| 984 | 984 |
| 985 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 985 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |