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_dialog_controller.h" | 57 #include "chrome/browser/printing/print_preview_dialog_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 // TODO(joi): Switch to returning just PrefService, since those |
| 404 // calling this function shouldn't be doing ad-hoc registration, that |
| 405 // happens earlier in browser_prefs::RegisterLocalState. |
| 406 PrefServiceSimple* BrowserProcessImpl::local_state() { |
404 DCHECK(CalledOnValidThread()); | 407 DCHECK(CalledOnValidThread()); |
405 if (!created_local_state_) | 408 if (!created_local_state_) |
406 CreateLocalState(); | 409 CreateLocalState(); |
407 return local_state_.get(); | 410 return local_state_.get(); |
408 } | 411 } |
409 | 412 |
410 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { | 413 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { |
411 DCHECK(CalledOnValidThread()); | 414 DCHECK(CalledOnValidThread()); |
412 return io_thread()->system_url_request_context_getter(); | 415 return io_thread()->system_url_request_context_getter(); |
413 } | 416 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 profile_manager_.reset(new ProfileManager(user_data_dir)); | 731 profile_manager_.reset(new ProfileManager(user_data_dir)); |
729 } | 732 } |
730 | 733 |
731 void BrowserProcessImpl::CreateLocalState() { | 734 void BrowserProcessImpl::CreateLocalState() { |
732 DCHECK(!created_local_state_ && local_state_.get() == NULL); | 735 DCHECK(!created_local_state_ && local_state_.get() == NULL); |
733 created_local_state_ = true; | 736 created_local_state_ = true; |
734 | 737 |
735 FilePath local_state_path; | 738 FilePath local_state_path; |
736 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); | 739 CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); |
737 local_state_.reset( | 740 local_state_.reset( |
738 ChromePrefServiceBuilder().CreateChromePrefs(local_state_path, | 741 chrome_prefs::CreateLocalState(local_state_path, |
739 local_state_task_runner_, | 742 local_state_task_runner_, |
740 policy_service(), | 743 policy_service(), |
741 NULL, false)); | 744 NULL, false)); |
742 | 745 |
743 // Initialize the prefs of the local state. | 746 // Initialize the prefs of the local state. |
744 chrome::RegisterLocalState(local_state_.get()); | 747 chrome::RegisterLocalState(local_state_.get()); |
745 | 748 |
746 pref_change_registrar_.Init(local_state_.get()); | 749 pref_change_registrar_.Init(local_state_.get()); |
747 | 750 |
748 // Initialize the notification for the default browser setting policy. | 751 // Initialize the notification for the default browser setting policy. |
749 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 752 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
750 false); | 753 false); |
751 pref_change_registrar_.Add( | 754 pref_change_registrar_.Add( |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 } | 983 } |
981 | 984 |
982 void BrowserProcessImpl::OnAutoupdateTimer() { | 985 void BrowserProcessImpl::OnAutoupdateTimer() { |
983 if (CanAutorestartForUpdate()) { | 986 if (CanAutorestartForUpdate()) { |
984 DLOG(WARNING) << "Detected update. Restarting browser."; | 987 DLOG(WARNING) << "Detected update. Restarting browser."; |
985 RestartBackgroundInstance(); | 988 RestartBackgroundInstance(); |
986 } | 989 } |
987 } | 990 } |
988 | 991 |
989 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 992 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |