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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/chrome_version_info.h" | 43 #include "chrome/common/chrome_version_info.h" |
44 #include "chrome/common/extensions/extension.h" | 44 #include "chrome/common/extensions/extension.h" |
45 #include "chrome/common/extensions/features/feature.h" | 45 #include "chrome/common/extensions/features/feature.h" |
46 #include "chrome/common/extensions/manifest.h" | 46 #include "chrome/common/extensions/manifest.h" |
47 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
48 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/url_data_source.h" | 49 #include "content/public/browser/url_data_source.h" |
50 | 50 |
51 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
| 52 #include "chrome/browser/app_mode/app_mode_utils.h" |
52 #include "chrome/browser/chromeos/login/user_manager.h" | 53 #include "chrome/browser/chromeos/login/user_manager.h" |
53 #endif | 54 #endif |
54 | 55 |
55 using content::BrowserThread; | 56 using content::BrowserThread; |
56 | 57 |
57 namespace extensions { | 58 namespace extensions { |
58 | 59 |
59 // | 60 // |
60 // ExtensionSystem | 61 // ExtensionSystem |
61 // | 62 // |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // load any extensions. | 156 // load any extensions. |
156 { | 157 { |
157 management_policy_.reset(new ManagementPolicy); | 158 management_policy_.reset(new ManagementPolicy); |
158 RegisterManagementPolicyProviders(); | 159 RegisterManagementPolicyProviders(); |
159 } | 160 } |
160 | 161 |
161 bool skip_session_extensions = false; | 162 bool skip_session_extensions = false; |
162 #if defined(OS_CHROMEOS) | 163 #if defined(OS_CHROMEOS) |
163 // Skip loading session extensions if we are not in a user session. | 164 // Skip loading session extensions if we are not in a user session. |
164 skip_session_extensions = !chromeos::UserManager::Get()->IsUserLoggedIn(); | 165 skip_session_extensions = !chromeos::UserManager::Get()->IsUserLoggedIn(); |
165 #endif | 166 if (!chrome::IsRunningInForcedAppMode()) { |
| 167 extension_service_->component_loader()->AddDefaultComponentExtensions( |
| 168 skip_session_extensions); |
| 169 } |
| 170 #else |
166 extension_service_->component_loader()->AddDefaultComponentExtensions( | 171 extension_service_->component_loader()->AddDefaultComponentExtensions( |
167 skip_session_extensions); | 172 skip_session_extensions); |
| 173 #endif |
168 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { | 174 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { |
169 CommandLine::StringType path_list = command_line->GetSwitchValueNative( | 175 CommandLine::StringType path_list = command_line->GetSwitchValueNative( |
170 switches::kLoadComponentExtension); | 176 switches::kLoadComponentExtension); |
171 base::StringTokenizerT<CommandLine::StringType, | 177 base::StringTokenizerT<CommandLine::StringType, |
172 CommandLine::StringType::const_iterator> t(path_list, | 178 CommandLine::StringType::const_iterator> t(path_list, |
173 FILE_PATH_LITERAL(",")); | 179 FILE_PATH_LITERAL(",")); |
174 while (t.GetNext()) { | 180 while (t.GetNext()) { |
175 // Load the component extension manifest synchronously. | 181 // Load the component extension manifest synchronously. |
176 // Blocking the UI thread is acceptable here since | 182 // Blocking the UI thread is acceptable here since |
177 // this flag designated for developers. | 183 // this flag designated for developers. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 462 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
457 const std::string& extension_id, | 463 const std::string& extension_id, |
458 const extension_misc::UnloadedExtensionReason reason) { | 464 const extension_misc::UnloadedExtensionReason reason) { |
459 BrowserThread::PostTask( | 465 BrowserThread::PostTask( |
460 BrowserThread::IO, FROM_HERE, | 466 BrowserThread::IO, FROM_HERE, |
461 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 467 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
462 extension_id, reason)); | 468 extension_id, reason)); |
463 } | 469 } |
464 | 470 |
465 } // namespace extensions | 471 } // namespace extensions |
OLD | NEW |