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/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" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 #include "chrome/common/chrome_version_info.h" | 41 #include "chrome/common/chrome_version_info.h" |
42 #include "chrome/common/extensions/extension.h" | 42 #include "chrome/common/extensions/extension.h" |
43 #include "chrome/common/extensions/features/feature_channel.h" | 43 #include "chrome/common/extensions/features/feature_channel.h" |
44 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/url_data_source.h" | 45 #include "content/public/browser/url_data_source.h" |
46 #include "extensions/common/constants.h" | 46 #include "extensions/common/constants.h" |
47 #include "extensions/common/manifest.h" | 47 #include "extensions/common/manifest.h" |
48 | 48 |
49 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
50 #include "chrome/browser/app_mode/app_mode_utils.h" | 50 #include "chrome/browser/app_mode/app_mode_utils.h" |
51 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol icy_provider.h" | |
52 #include "chrome/browser/chromeos/login/user.h" | |
53 #include "chrome/browser/chromeos/login/user_manager.h" | |
54 #include "chrome/browser/chromeos/policy/device_local_account.h" | |
51 #include "chromeos/chromeos_switches.h" | 55 #include "chromeos/chromeos_switches.h" |
52 #include "chromeos/login/login_state.h" | 56 #include "chromeos/login/login_state.h" |
53 #endif | 57 #endif |
54 | 58 |
55 using content::BrowserThread; | 59 using content::BrowserThread; |
56 | 60 |
57 namespace extensions { | 61 namespace extensions { |
58 | 62 |
59 // | 63 // |
60 // ExtensionSystem | 64 // ExtensionSystem |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 | 104 |
101 rules_store_.reset(new StateStore( | 105 rules_store_.reset(new StateStore( |
102 profile_, | 106 profile_, |
103 profile_->GetPath().AppendASCII(ExtensionService::kRulesStoreName), | 107 profile_->GetPath().AppendASCII(ExtensionService::kRulesStoreName), |
104 false)); | 108 false)); |
105 | 109 |
106 blacklist_.reset(new Blacklist(ExtensionPrefs::Get(profile_))); | 110 blacklist_.reset(new Blacklist(ExtensionPrefs::Get(profile_))); |
107 | 111 |
108 standard_management_policy_provider_.reset( | 112 standard_management_policy_provider_.reset( |
109 new StandardManagementPolicyProvider(ExtensionPrefs::Get(profile_))); | 113 new StandardManagementPolicyProvider(ExtensionPrefs::Get(profile_))); |
110 #endif | 114 |
115 #if defined (OS_CHROMEOS) | |
116 const chromeos::User* user = chromeos::UserManager::Get()->GetActiveUser(); | |
117 if (user && policy::IsDeviceLocalAccountUser(user->email())) { | |
118 device_local_account_management_policy_provider_.reset( | |
119 new chromeos::DeviceLocalAccountManagementPolicyProvider); | |
120 } | |
121 #endif // defined (OS_CHROMEOS) | |
122 | |
123 #endif // defined(ENABLE_EXTENSIONS) | |
111 } | 124 } |
112 | 125 |
113 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { | 126 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { |
114 // TODO(yoz): Remove once crbug.com/159265 is fixed. | 127 // TODO(yoz): Remove once crbug.com/159265 is fixed. |
115 #if defined(ENABLE_EXTENSIONS) | 128 #if defined(ENABLE_EXTENSIONS) |
116 DCHECK(standard_management_policy_provider_.get()); | 129 DCHECK(standard_management_policy_provider_.get()); |
117 management_policy_->RegisterProvider( | 130 management_policy_->RegisterProvider( |
118 standard_management_policy_provider_.get()); | 131 standard_management_policy_provider_.get()); |
119 #endif | 132 |
133 #if defined (OS_CHROMEOS) | |
134 if (device_local_account_management_policy_provider_) { | |
135 management_policy_->RegisterProvider( | |
136 device_local_account_management_policy_provider_.get()); | |
137 } | |
138 #endif // defined (OS_CHROMEOS) | |
139 | |
140 #endif // defined(ENABLE_EXTENSIONS) | |
asargent_no_longer_on_chrome
2013/09/24 20:29:00
It seems a little unfortunate to have this #ifdef'
bartfab (slow)
2013/09/26 12:39:13
Just to clarify, because the name is somewhat misl
| |
120 } | 141 } |
121 | 142 |
122 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { | 143 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
123 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 144 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
124 | 145 |
125 navigation_observer_.reset(new NavigationObserver(profile_)); | 146 navigation_observer_.reset(new NavigationObserver(profile_)); |
126 | 147 |
127 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); | 148 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); |
128 ExtensionErrorReporter::Init(allow_noisy_errors); | 149 ExtensionErrorReporter::Init(allow_noisy_errors); |
129 | 150 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 403 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
383 const std::string& extension_id, | 404 const std::string& extension_id, |
384 const extension_misc::UnloadedExtensionReason reason) { | 405 const extension_misc::UnloadedExtensionReason reason) { |
385 BrowserThread::PostTask( | 406 BrowserThread::PostTask( |
386 BrowserThread::IO, FROM_HERE, | 407 BrowserThread::IO, FROM_HERE, |
387 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 408 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
388 extension_id, reason)); | 409 extension_id, reason)); |
389 } | 410 } |
390 | 411 |
391 } // namespace extensions | 412 } // namespace extensions |
OLD | NEW |