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/extensions/extension_system.h" | 5 #include "chrome/browser/extensions/extension_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/string_tokenizer.h" | 10 #include "base/string_tokenizer.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 | 78 |
79 void ExtensionSystemImpl::Shared::InitPrefs() { | 79 void ExtensionSystemImpl::Shared::InitPrefs() { |
80 bool extensions_disabled = | 80 bool extensions_disabled = |
81 profile_->GetPrefs()->GetBoolean(prefs::kDisableExtensions) || | 81 profile_->GetPrefs()->GetBoolean(prefs::kDisableExtensions) || |
82 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); | 82 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); |
83 extension_prefs_.reset(new ExtensionPrefs( | 83 extension_prefs_.reset(new ExtensionPrefs( |
84 profile_->GetPrefs(), | 84 profile_->GetPrefs(), |
85 profile_->GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | 85 profile_->GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), |
86 ExtensionPrefValueMapFactory::GetForProfile(profile_))); | 86 ExtensionPrefValueMapFactory::GetForProfile(profile_))); |
87 extension_prefs_->Init(extensions_disabled); | 87 extension_prefs_->Init(extensions_disabled); |
88 lazy_background_task_queue_.reset(new LazyBackgroundTaskQueue(profile_)); | |
89 event_router_.reset(new EventRouter(profile_, extension_prefs_.get())); | |
Matt Perry
2012/11/09 00:23:34
Weird... these aren't prefs.
Yoyo Zhou
2012/11/09 00:35:55
Yeah, the InitPrefs name is no longer appropriate.
| |
88 | 90 |
89 state_store_.reset(new StateStore( | 91 state_store_.reset(new StateStore( |
90 profile_, | 92 profile_, |
91 profile_->GetPath().AppendASCII(ExtensionService::kStateStoreName))); | 93 profile_->GetPath().AppendASCII(ExtensionService::kStateStoreName))); |
92 | 94 |
93 shell_window_geometry_cache_.reset(new ShellWindowGeometryCache( | 95 shell_window_geometry_cache_.reset(new ShellWindowGeometryCache( |
94 profile_, state_store_.get())); | 96 profile_, state_store_.get())); |
95 } | 97 } |
96 | 98 |
97 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { | 99 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { |
98 DCHECK(extension_prefs_.get()); | 100 DCHECK(extension_prefs_.get()); |
99 management_policy_->RegisterProvider(extension_prefs_.get()); | 101 management_policy_->RegisterProvider(extension_prefs_.get()); |
100 } | 102 } |
101 | 103 |
102 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { | 104 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
103 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 105 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
104 | 106 |
105 lazy_background_task_queue_.reset(new LazyBackgroundTaskQueue(profile_)); | |
106 message_service_.reset(new MessageService(lazy_background_task_queue_.get())); | 107 message_service_.reset(new MessageService(lazy_background_task_queue_.get())); |
107 extension_event_router_.reset(new EventRouter(profile_, | |
108 extension_prefs_.get())); | |
109 navigation_observer_.reset(new NavigationObserver(profile_)); | 108 navigation_observer_.reset(new NavigationObserver(profile_)); |
110 | 109 |
111 ExtensionErrorReporter::Init(true); // allow noisy errors. | 110 ExtensionErrorReporter::Init(true); // allow noisy errors. |
112 | 111 |
113 user_script_master_ = new UserScriptMaster(profile_); | 112 user_script_master_ = new UserScriptMaster(profile_); |
114 | 113 |
115 bool autoupdate_enabled = true; | 114 bool autoupdate_enabled = true; |
116 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
117 if (!extensions_enabled) | 116 if (!extensions_enabled) |
118 autoupdate_enabled = false; | 117 autoupdate_enabled = false; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 LazyBackgroundTaskQueue* | 229 LazyBackgroundTaskQueue* |
231 ExtensionSystemImpl::Shared::lazy_background_task_queue() { | 230 ExtensionSystemImpl::Shared::lazy_background_task_queue() { |
232 return lazy_background_task_queue_.get(); | 231 return lazy_background_task_queue_.get(); |
233 } | 232 } |
234 | 233 |
235 MessageService* ExtensionSystemImpl::Shared::message_service() { | 234 MessageService* ExtensionSystemImpl::Shared::message_service() { |
236 return message_service_.get(); | 235 return message_service_.get(); |
237 } | 236 } |
238 | 237 |
239 EventRouter* ExtensionSystemImpl::Shared::event_router() { | 238 EventRouter* ExtensionSystemImpl::Shared::event_router() { |
240 return extension_event_router_.get(); | 239 return event_router_.get(); |
241 } | 240 } |
242 | 241 |
243 // | 242 // |
244 // ExtensionSystemImpl | 243 // ExtensionSystemImpl |
245 // | 244 // |
246 | 245 |
247 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) | 246 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) |
248 : profile_(profile), | 247 : profile_(profile), |
249 extension_devtools_manager_(NULL) { | 248 extension_devtools_manager_(NULL) { |
250 shared_ = ExtensionSystemSharedFactory::GetForProfile(profile); | 249 shared_ = ExtensionSystemSharedFactory::GetForProfile(profile); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 392 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
394 const std::string& extension_id, | 393 const std::string& extension_id, |
395 const extension_misc::UnloadedExtensionReason reason) { | 394 const extension_misc::UnloadedExtensionReason reason) { |
396 BrowserThread::PostTask( | 395 BrowserThread::PostTask( |
397 BrowserThread::IO, FROM_HERE, | 396 BrowserThread::IO, FROM_HERE, |
398 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 397 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
399 extension_id, reason)); | 398 extension_id, reason)); |
400 } | 399 } |
401 | 400 |
402 } // namespace extensions | 401 } // namespace extensions |
OLD | NEW |