| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 if (manifest) { | 323 if (manifest) { |
| 324 // Update manifest to use a proper name. | 324 // Update manifest to use a proper name. |
| 325 manifest->SetString(extension_manifest_keys::kName, | 325 manifest->SetString(extension_manifest_keys::kName, |
| 326 l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); | 326 l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); |
| 327 Add(manifest, base::FilePath(FILE_PATH_LITERAL("chrome_app"))); | 327 Add(manifest, base::FilePath(FILE_PATH_LITERAL("chrome_app"))); |
| 328 } | 328 } |
| 329 #endif | 329 #endif |
| 330 } | 330 } |
| 331 | 331 |
| 332 void ComponentLoader::AddVirtualKeyboardApp() { |
| 333 #if defined(USE_ASH) |
| 334 std::string id = Add(IDR_VIRTUAL_KEYBOARD_MANIFEST, |
| 335 base::FilePath(FILE_PATH_LITERAL("virtual_keyboard"))); |
| 336 #endif |
| 337 } |
| 338 |
| 332 // static | 339 // static |
| 333 void ComponentLoader::EnableBackgroundExtensionsForTesting() { | 340 void ComponentLoader::EnableBackgroundExtensionsForTesting() { |
| 334 enable_background_extensions_during_testing = true; | 341 enable_background_extensions_during_testing = true; |
| 335 } | 342 } |
| 336 | 343 |
| 337 void ComponentLoader::AddDefaultComponentExtensions( | 344 void ComponentLoader::AddDefaultComponentExtensions( |
| 338 bool skip_session_components) { | 345 bool skip_session_components) { |
| 339 // Do not add component extensions that have background pages here -- add them | 346 // Do not add component extensions that have background pages here -- add them |
| 340 // to AddDefaultComponentExtensionsWithBackgroundPages. | 347 // to AddDefaultComponentExtensionsWithBackgroundPages. |
| 341 #if defined(OS_CHROMEOS) | 348 #if defined(OS_CHROMEOS) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 if (!skip_session_components) { | 381 if (!skip_session_components) { |
| 375 Add(IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); | 382 Add(IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); |
| 376 | 383 |
| 377 // If a URL for the enterprise webstore has been specified, load the | 384 // If a URL for the enterprise webstore has been specified, load the |
| 378 // component extension. This extension might also be loaded later, because | 385 // component extension. This extension might also be loaded later, because |
| 379 // it is specified by policy, and on ChromeOS policies are loaded after | 386 // it is specified by policy, and on ChromeOS policies are loaded after |
| 380 // the browser process has started. | 387 // the browser process has started. |
| 381 AddOrReloadEnterpriseWebStore(); | 388 AddOrReloadEnterpriseWebStore(); |
| 382 | 389 |
| 383 AddChromeApp(); | 390 AddChromeApp(); |
| 391 AddVirtualKeyboardApp(); |
| 384 } | 392 } |
| 385 | 393 |
| 386 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); | 394 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); |
| 387 } | 395 } |
| 388 | 396 |
| 389 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( | 397 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( |
| 390 bool skip_session_components) { | 398 bool skip_session_components) { |
| 391 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 399 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 392 | 400 |
| 393 // Component extensions with background pages are not enabled during tests | 401 // Component extensions with background pages are not enabled during tests |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 479 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 472 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 480 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
| 473 std::string() /* default_value */, | 481 std::string() /* default_value */, |
| 474 PrefRegistrySyncable::UNSYNCABLE_PREF); | 482 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 475 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 483 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
| 476 std::string() /* default_value */, | 484 std::string() /* default_value */, |
| 477 PrefRegistrySyncable::UNSYNCABLE_PREF); | 485 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 478 } | 486 } |
| 479 | 487 |
| 480 } // namespace extensions | 488 } // namespace extensions |
| OLD | NEW |