OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_impl.h" | 5 #include "chrome/browser/extensions/extension_system_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 extension_service_->Init(); | 256 extension_service_->Init(); |
257 | 257 |
258 // Make sure ExtensionSyncService is created. | 258 // Make sure ExtensionSyncService is created. |
259 ExtensionSyncService::Get(profile_); | 259 ExtensionSyncService::Get(profile_); |
260 | 260 |
261 // Make the chrome://extension-icon/ resource available. | 261 // Make the chrome://extension-icon/ resource available. |
262 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); | 262 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); |
263 | 263 |
264 quota_service_.reset(new QuotaService); | 264 quota_service_.reset(new QuotaService); |
265 | |
266 if (extensions_enabled) { | |
267 // Load any extensions specified with --load-extension. | |
268 // TODO(yoz): Seems like this should move into ExtensionService::Init. | |
269 // But maybe it's no longer important. | |
270 if (command_line->HasSwitch(switches::kLoadExtension)) { | |
271 base::CommandLine::StringType path_list = | |
272 command_line->GetSwitchValueNative(switches::kLoadExtension); | |
273 base::StringTokenizerT<base::CommandLine::StringType, | |
274 base::CommandLine::StringType::const_iterator> | |
275 t(path_list, FILE_PATH_LITERAL(",")); | |
276 while (t.GetNext()) { | |
277 std::string extension_id; | |
278 UnpackedInstaller::Create(extension_service_.get()) | |
279 ->LoadFromCommandLine(base::FilePath(t.token()), &extension_id, | |
280 false /* only_allow_apps */); | |
281 } | |
282 } | |
283 } | |
284 } | 265 } |
285 | 266 |
286 void ExtensionSystemImpl::Shared::Shutdown() { | 267 void ExtensionSystemImpl::Shared::Shutdown() { |
287 if (content_verifier_.get()) | 268 if (content_verifier_.get()) |
288 content_verifier_->Shutdown(); | 269 content_verifier_->Shutdown(); |
289 if (extension_service_) | 270 if (extension_service_) |
290 extension_service_->Shutdown(); | 271 extension_service_->Shutdown(); |
291 } | 272 } |
292 | 273 |
293 ServiceWorkerManager* ExtensionSystemImpl::Shared::service_worker_manager() { | 274 ServiceWorkerManager* ExtensionSystemImpl::Shared::service_worker_manager() { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 448 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
468 const std::string& extension_id, | 449 const std::string& extension_id, |
469 const UnloadedExtensionInfo::Reason reason) { | 450 const UnloadedExtensionInfo::Reason reason) { |
470 BrowserThread::PostTask( | 451 BrowserThread::PostTask( |
471 BrowserThread::IO, | 452 BrowserThread::IO, |
472 FROM_HERE, | 453 FROM_HERE, |
473 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 454 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
474 } | 455 } |
475 | 456 |
476 } // namespace extensions | 457 } // namespace extensions |
OLD | NEW |