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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 created_safe_browsing_service_(false), | 132 created_safe_browsing_service_(false), |
133 created_safe_browsing_detection_service_(false), | 133 created_safe_browsing_detection_service_(false), |
134 module_ref_count_(0), | 134 module_ref_count_(0), |
135 did_start_(false), | 135 did_start_(false), |
136 checked_for_new_frames_(false), | 136 checked_for_new_frames_(false), |
137 using_new_frames_(false) { | 137 using_new_frames_(false) { |
138 g_browser_process = this; | 138 g_browser_process = this; |
139 clipboard_.reset(new ui::Clipboard); | 139 clipboard_.reset(new ui::Clipboard); |
140 main_notification_service_.reset(new NotificationService); | 140 main_notification_service_.reset(new NotificationService); |
141 | 141 |
142 notification_registrar_.Add(this, | |
143 NotificationType::APP_TERMINATING, | |
144 NotificationService::AllSources()); | |
145 | |
146 // Must be created after the NotificationService. | 142 // Must be created after the NotificationService. |
147 print_job_manager_.reset(new printing::PrintJobManager); | 143 print_job_manager_.reset(new printing::PrintJobManager); |
148 | 144 |
149 net_log_.reset(new ChromeNetLog); | 145 net_log_.reset(new ChromeNetLog); |
150 | 146 |
151 extension_event_router_forwarder_ = new ExtensionEventRouterForwarder; | 147 extension_event_router_forwarder_ = new ExtensionEventRouterForwarder; |
152 | 148 |
153 ExtensionTabIdMap::GetInstance()->Init(); | 149 ExtensionTabIdMap::GetInstance()->Init(); |
154 } | 150 } |
155 | 151 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 return safe_browsing_detection_service_.get(); | 628 return safe_browsing_detection_service_.get(); |
633 } | 629 } |
634 | 630 |
635 bool BrowserProcessImpl::plugin_finder_disabled() const { | 631 bool BrowserProcessImpl::plugin_finder_disabled() const { |
636 return *plugin_finder_disabled_pref_; | 632 return *plugin_finder_disabled_pref_; |
637 } | 633 } |
638 | 634 |
639 void BrowserProcessImpl::Observe(NotificationType type, | 635 void BrowserProcessImpl::Observe(NotificationType type, |
640 const NotificationSource& source, | 636 const NotificationSource& source, |
641 const NotificationDetails& details) { | 637 const NotificationDetails& details) { |
642 if (type == NotificationType::APP_TERMINATING) { | 638 if (type == NotificationType::PREF_CHANGED) { |
643 Profile* profile = ProfileManager::GetDefaultProfile(); | |
644 if (profile) { | |
645 PrefService* prefs = profile->GetPrefs(); | |
646 if (prefs->GetBoolean(prefs::kClearSiteDataOnExit) && | |
647 local_state()->GetBoolean(prefs::kClearPluginLSODataEnabled)) { | |
648 plugin_data_remover_ = new PluginDataRemover(); | |
649 if (!plugin_data_remover_mime_type().empty()) | |
650 plugin_data_remover_->set_mime_type(plugin_data_remover_mime_type()); | |
651 plugin_data_remover_->StartRemoving(base::Time()); | |
652 } | |
653 } | |
654 } else if (type == NotificationType::PREF_CHANGED) { | |
655 std::string* pref = Details<std::string>(details).ptr(); | 639 std::string* pref = Details<std::string>(details).ptr(); |
656 if (*pref == prefs::kDefaultBrowserSettingEnabled) { | 640 if (*pref == prefs::kDefaultBrowserSettingEnabled) { |
657 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) | 641 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) |
658 ShellIntegration::SetAsDefaultBrowser(); | 642 ShellIntegration::SetAsDefaultBrowser(); |
659 } else if (*pref == prefs::kDisabledSchemes) { | 643 } else if (*pref == prefs::kDisabledSchemes) { |
660 ApplyDisabledSchemesPolicy(); | 644 ApplyDisabledSchemesPolicy(); |
661 } else if (*pref == prefs::kAllowCrossOriginAuthPrompt) { | 645 } else if (*pref == prefs::kAllowCrossOriginAuthPrompt) { |
662 ApplyAllowCrossOriginAuthPromptPolicy(); | 646 ApplyAllowCrossOriginAuthPromptPolicy(); |
663 } | 647 } |
664 } else { | 648 } else { |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 } | 1117 } |
1134 | 1118 |
1135 void BrowserProcessImpl::OnAutoupdateTimer() { | 1119 void BrowserProcessImpl::OnAutoupdateTimer() { |
1136 if (CanAutorestartForUpdate()) { | 1120 if (CanAutorestartForUpdate()) { |
1137 DLOG(WARNING) << "Detected update. Restarting browser."; | 1121 DLOG(WARNING) << "Detected update. Restarting browser."; |
1138 RestartPersistentInstance(); | 1122 RestartPersistentInstance(); |
1139 } | 1123 } |
1140 } | 1124 } |
1141 | 1125 |
1142 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1126 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |