| 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/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 command_line->GetSwitchValuePath(switches::kImageLoaderExtensionPath)); | 267 command_line->GetSwitchValuePath(switches::kImageLoaderExtensionPath)); |
| 268 Add(IDR_IMAGE_LOADER_MANIFEST, image_loader_extension_path); | 268 Add(IDR_IMAGE_LOADER_MANIFEST, image_loader_extension_path); |
| 269 return; | 269 return; |
| 270 } | 270 } |
| 271 #endif // NDEBUG | 271 #endif // NDEBUG |
| 272 Add(IDR_IMAGE_LOADER_MANIFEST, | 272 Add(IDR_IMAGE_LOADER_MANIFEST, |
| 273 base::FilePath(FILE_PATH_LITERAL("image_loader"))); | 273 base::FilePath(FILE_PATH_LITERAL("image_loader"))); |
| 274 #endif // defined(IMAGE_LOADER_EXTENSION) | 274 #endif // defined(IMAGE_LOADER_EXTENSION) |
| 275 } | 275 } |
| 276 | 276 |
| 277 #if defined(OS_CHROMEOS) | |
| 278 void ComponentLoader::AddGaiaAuthExtension() { | |
| 279 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 280 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | |
| 281 base::FilePath auth_extension_path = | |
| 282 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); | |
| 283 Add(IDR_GAIA_TEST_AUTH_MANIFEST, auth_extension_path); | |
| 284 return; | |
| 285 } | |
| 286 Add(IDR_GAIA_AUTH_MANIFEST, base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); | |
| 287 } | |
| 288 #endif // NDEBUG | |
| 289 | |
| 290 void ComponentLoader::AddOrReloadEnterpriseWebStore() { | 277 void ComponentLoader::AddOrReloadEnterpriseWebStore() { |
| 291 base::FilePath path(FILE_PATH_LITERAL("enterprise_web_store")); | 278 base::FilePath path(FILE_PATH_LITERAL("enterprise_web_store")); |
| 292 | 279 |
| 293 // Remove the extension if it was already loaded. | 280 // Remove the extension if it was already loaded. |
| 294 Remove(path); | 281 Remove(path); |
| 295 | 282 |
| 296 std::string enterprise_webstore_url = | 283 std::string enterprise_webstore_url = |
| 297 profile_prefs_->GetString(prefs::kEnterpriseWebStoreURL); | 284 profile_prefs_->GetString(prefs::kEnterpriseWebStoreURL); |
| 298 | 285 |
| 299 // Load the extension only if the URL preference is set. | 286 // Load the extension only if the URL preference is set. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 326 } |
| 340 | 327 |
| 341 void ComponentLoader::AddDefaultComponentExtensions( | 328 void ComponentLoader::AddDefaultComponentExtensions( |
| 342 bool skip_session_components) { | 329 bool skip_session_components) { |
| 343 // Do not add component extensions that have background pages here -- add them | 330 // Do not add component extensions that have background pages here -- add them |
| 344 // to AddDefaultComponentExtensionsWithBackgroundPages. | 331 // to AddDefaultComponentExtensionsWithBackgroundPages. |
| 345 #if defined(OS_CHROMEOS) | 332 #if defined(OS_CHROMEOS) |
| 346 Add(IDR_MOBILE_MANIFEST, | 333 Add(IDR_MOBILE_MANIFEST, |
| 347 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); | 334 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); |
| 348 | 335 |
| 349 if (skip_session_components) | |
| 350 AddGaiaAuthExtension(); | |
| 351 | |
| 352 #if defined(OFFICIAL_BUILD) | 336 #if defined(OFFICIAL_BUILD) |
| 353 if (browser_defaults::enable_help_app) { | 337 if (browser_defaults::enable_help_app) { |
| 354 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( | 338 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( |
| 355 "/usr/share/chromeos-assets/helpapp"))); | 339 "/usr/share/chromeos-assets/helpapp"))); |
| 356 } | 340 } |
| 357 #endif | 341 #endif |
| 358 | 342 |
| 359 // Skip all other extensions that require user session presence. | 343 // Skip all other extensions that require user session presence. |
| 360 if (!skip_session_components) { | 344 if (!skip_session_components) { |
| 361 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 345 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 459 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 476 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 460 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
| 477 std::string() /* default_value */, | 461 std::string() /* default_value */, |
| 478 PrefRegistrySyncable::UNSYNCABLE_PREF); | 462 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 479 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 463 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
| 480 std::string() /* default_value */, | 464 std::string() /* default_value */, |
| 481 PrefRegistrySyncable::UNSYNCABLE_PREF); | 465 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 482 } | 466 } |
| 483 | 467 |
| 484 } // namespace extensions | 468 } // namespace extensions |
| OLD | NEW |