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(extensions::kRulesStoreName), | 107 profile_->GetPath().AppendASCII(extensions::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 policy::DeviceLocalAccount::Type device_local_account_type; |
| 118 if (user && policy::IsDeviceLocalAccountUser(user->email(), |
| 119 &device_local_account_type)) { |
| 120 device_local_account_management_policy_provider_.reset( |
| 121 new chromeos::DeviceLocalAccountManagementPolicyProvider( |
| 122 device_local_account_type)); |
| 123 } |
| 124 #endif // defined (OS_CHROMEOS) |
| 125 |
| 126 #endif // defined(ENABLE_EXTENSIONS) |
111 } | 127 } |
112 | 128 |
113 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { | 129 void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { |
114 // TODO(yoz): Remove once crbug.com/159265 is fixed. | 130 // TODO(yoz): Remove once crbug.com/159265 is fixed. |
115 #if defined(ENABLE_EXTENSIONS) | 131 #if defined(ENABLE_EXTENSIONS) |
116 DCHECK(standard_management_policy_provider_.get()); | 132 DCHECK(standard_management_policy_provider_.get()); |
117 management_policy_->RegisterProvider( | 133 management_policy_->RegisterProvider( |
118 standard_management_policy_provider_.get()); | 134 standard_management_policy_provider_.get()); |
119 #endif | 135 |
| 136 #if defined (OS_CHROMEOS) |
| 137 if (device_local_account_management_policy_provider_) { |
| 138 management_policy_->RegisterProvider( |
| 139 device_local_account_management_policy_provider_.get()); |
| 140 } |
| 141 #endif // defined (OS_CHROMEOS) |
| 142 |
| 143 #endif // defined(ENABLE_EXTENSIONS) |
120 } | 144 } |
121 | 145 |
122 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { | 146 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
123 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 147 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
124 | 148 |
125 navigation_observer_.reset(new NavigationObserver(profile_)); | 149 navigation_observer_.reset(new NavigationObserver(profile_)); |
126 | 150 |
127 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); | 151 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); |
128 ExtensionErrorReporter::Init(allow_noisy_errors); | 152 ExtensionErrorReporter::Init(allow_noisy_errors); |
129 | 153 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 406 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
383 const std::string& extension_id, | 407 const std::string& extension_id, |
384 const extension_misc::UnloadedExtensionReason reason) { | 408 const extension_misc::UnloadedExtensionReason reason) { |
385 BrowserThread::PostTask( | 409 BrowserThread::PostTask( |
386 BrowserThread::IO, FROM_HERE, | 410 BrowserThread::IO, FROM_HERE, |
387 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 411 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
388 extension_id, reason)); | 412 extension_id, reason)); |
389 } | 413 } |
390 | 414 |
391 } // namespace extensions | 415 } // namespace extensions |
OLD | NEW |