OLD | NEW |
1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/extensions/extension_system_impl.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/strings/string_tokenizer.h" | 11 #include "base/strings/string_tokenizer.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/content_settings/cookie_settings.h" | 13 #include "chrome/browser/content_settings/cookie_settings.h" |
14 #include "chrome/browser/extensions/blacklist.h" | 14 #include "chrome/browser/extensions/blacklist.h" |
15 #include "chrome/browser/extensions/component_loader.h" | 15 #include "chrome/browser/extensions/component_loader.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "chrome/browser/chromeos/policy/device_local_account.h" | 63 #include "chrome/browser/chromeos/policy/device_local_account.h" |
64 #include "chromeos/chromeos_switches.h" | 64 #include "chromeos/chromeos_switches.h" |
65 #include "chromeos/login/login_state.h" | 65 #include "chromeos/login/login_state.h" |
66 #endif | 66 #endif |
67 | 67 |
68 using content::BrowserThread; | 68 using content::BrowserThread; |
69 | 69 |
70 namespace extensions { | 70 namespace extensions { |
71 | 71 |
72 // | 72 // |
73 // ExtensionSystem | |
74 // | |
75 | |
76 ExtensionSystem::ExtensionSystem() { | |
77 // Only set if it hasn't already been set (e.g. by a test). | |
78 if (GetCurrentChannel() == GetDefaultChannel()) | |
79 SetCurrentChannel(chrome::VersionInfo::GetChannel()); | |
80 } | |
81 | |
82 ExtensionSystem::~ExtensionSystem() { | |
83 } | |
84 | |
85 // static | |
86 ExtensionSystem* ExtensionSystem::Get(Profile* profile) { | |
87 return ExtensionSystemFactory::GetForProfile(profile); | |
88 } | |
89 | |
90 // static | |
91 ExtensionSystem* ExtensionSystem::GetForBrowserContext( | |
92 content::BrowserContext* profile) { | |
93 return ExtensionSystemFactory::GetForProfile(static_cast<Profile*>(profile)); | |
94 } | |
95 | |
96 // | |
97 // ExtensionSystemImpl::Shared | 73 // ExtensionSystemImpl::Shared |
98 // | 74 // |
99 | 75 |
100 ExtensionSystemImpl::Shared::Shared(Profile* profile) | 76 ExtensionSystemImpl::Shared::Shared(Profile* profile) |
101 : profile_(profile) { | 77 : profile_(profile) { |
102 } | 78 } |
103 | 79 |
104 ExtensionSystemImpl::Shared::~Shared() { | 80 ExtensionSystemImpl::Shared::~Shared() { |
105 } | 81 } |
106 | 82 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { | 302 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { |
327 return install_verifier_.get(); | 303 return install_verifier_.get(); |
328 } | 304 } |
329 | 305 |
330 // | 306 // |
331 // ExtensionSystemImpl | 307 // ExtensionSystemImpl |
332 // | 308 // |
333 | 309 |
334 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) | 310 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) |
335 : profile_(profile) { | 311 : profile_(profile) { |
336 shared_ = ExtensionSystemSharedFactory::GetForProfile(profile); | 312 shared_ = ExtensionSystemSharedFactory::GetForBrowserContext(profile); |
337 | 313 |
338 if (profile->IsOffTheRecord()) { | 314 if (profile->IsOffTheRecord()) { |
339 process_manager_.reset(ProcessManager::Create(profile)); | 315 process_manager_.reset(ProcessManager::Create(profile)); |
340 } else { | 316 } else { |
341 shared_->InitPrefs(); | 317 shared_->InitPrefs(); |
342 } | 318 } |
343 } | 319 } |
344 | 320 |
345 ExtensionSystemImpl::~ExtensionSystemImpl() { | 321 ExtensionSystemImpl::~ExtensionSystemImpl() { |
346 } | 322 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 427 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
452 const std::string& extension_id, | 428 const std::string& extension_id, |
453 const UnloadedExtensionInfo::Reason reason) { | 429 const UnloadedExtensionInfo::Reason reason) { |
454 BrowserThread::PostTask( | 430 BrowserThread::PostTask( |
455 BrowserThread::IO, | 431 BrowserThread::IO, |
456 FROM_HERE, | 432 FROM_HERE, |
457 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 433 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
458 } | 434 } |
459 | 435 |
460 } // namespace extensions | 436 } // namespace extensions |
OLD | NEW |