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 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/extensions/extension_file_util.h" | 21 #include "chrome/common/extensions/extension_file_util.h" |
22 #include "chrome/common/extensions/extension_manifest_constants.h" | 22 #include "chrome/common/extensions/extension_manifest_constants.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "components/user_prefs/pref_registry_syncable.h" | 24 #include "components/user_prefs/pref_registry_syncable.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
27 #include "extensions/common/id_util.h" | 27 #include "extensions/common/id_util.h" |
28 #include "grit/browser_resources.h" | 28 #include "grit/browser_resources.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 | 30 |
31 #if defined(USE_AURA) | |
32 #include "grit/keyboard_resources.h" | |
33 #endif | |
34 | |
35 #if defined(OFFICIAL_BUILD) | 31 #if defined(OFFICIAL_BUILD) |
36 #include "chrome/browser/defaults.h" | 32 #include "chrome/browser/defaults.h" |
37 #endif | 33 #endif |
38 | 34 |
39 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
40 #include "chrome/browser/chromeos/login/user_manager.h" | 36 #include "chrome/browser/chromeos/login/user_manager.h" |
41 #include "chromeos/chromeos_switches.h" | 37 #include "chromeos/chromeos_switches.h" |
42 #endif | 38 #endif |
43 | 39 |
44 #if defined(ENABLE_APP_LIST) | 40 #if defined(ENABLE_APP_LIST) |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 326 |
331 if (manifest) { | 327 if (manifest) { |
332 // Update manifest to use a proper name. | 328 // Update manifest to use a proper name. |
333 manifest->SetString(extension_manifest_keys::kName, | 329 manifest->SetString(extension_manifest_keys::kName, |
334 l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); | 330 l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); |
335 Add(manifest, base::FilePath(FILE_PATH_LITERAL("chrome_app"))); | 331 Add(manifest, base::FilePath(FILE_PATH_LITERAL("chrome_app"))); |
336 } | 332 } |
337 #endif | 333 #endif |
338 } | 334 } |
339 | 335 |
340 void ComponentLoader::AddKeyboardApp() { | |
341 #if defined(USE_AURA) | |
342 Add(IDR_KEYBOARD_MANIFEST, base::FilePath(FILE_PATH_LITERAL("keyboard"))); | |
343 #endif | |
344 } | |
345 | |
346 // static | 336 // static |
347 void ComponentLoader::EnableBackgroundExtensionsForTesting() { | 337 void ComponentLoader::EnableBackgroundExtensionsForTesting() { |
348 enable_background_extensions_during_testing = true; | 338 enable_background_extensions_during_testing = true; |
349 } | 339 } |
350 | 340 |
351 void ComponentLoader::AddDefaultComponentExtensions( | 341 void ComponentLoader::AddDefaultComponentExtensions( |
352 bool skip_session_components) { | 342 bool skip_session_components) { |
353 // Do not add component extensions that have background pages here -- add them | 343 // Do not add component extensions that have background pages here -- add them |
354 // to AddDefaultComponentExtensionsWithBackgroundPages. | 344 // to AddDefaultComponentExtensionsWithBackgroundPages. |
355 #if defined(OS_CHROMEOS) | 345 #if defined(OS_CHROMEOS) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 380 |
391 // If a URL for the enterprise webstore has been specified, load the | 381 // If a URL for the enterprise webstore has been specified, load the |
392 // component extension. This extension might also be loaded later, because | 382 // component extension. This extension might also be loaded later, because |
393 // it is specified by policy, and on ChromeOS policies are loaded after | 383 // it is specified by policy, and on ChromeOS policies are loaded after |
394 // the browser process has started. | 384 // the browser process has started. |
395 AddOrReloadEnterpriseWebStore(); | 385 AddOrReloadEnterpriseWebStore(); |
396 | 386 |
397 AddChromeApp(); | 387 AddChromeApp(); |
398 } | 388 } |
399 | 389 |
400 AddKeyboardApp(); | |
401 | |
402 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); | 390 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); |
403 } | 391 } |
404 | 392 |
405 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( | 393 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( |
406 bool skip_session_components) { | 394 bool skip_session_components) { |
407 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 395 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
408 | 396 |
409 // Component extensions with background pages are not enabled during tests | 397 // Component extensions with background pages are not enabled during tests |
410 // because they generate a lot of background behavior that can interfere. | 398 // because they generate a lot of background behavior that can interfere. |
411 if (!enable_background_extensions_during_testing && | 399 if (!enable_background_extensions_during_testing && |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 475 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
488 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 476 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
489 std::string() /* default_value */, | 477 std::string() /* default_value */, |
490 PrefRegistrySyncable::UNSYNCABLE_PREF); | 478 PrefRegistrySyncable::UNSYNCABLE_PREF); |
491 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 479 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
492 std::string() /* default_value */, | 480 std::string() /* default_value */, |
493 PrefRegistrySyncable::UNSYNCABLE_PREF); | 481 PrefRegistrySyncable::UNSYNCABLE_PREF); |
494 } | 482 } |
495 | 483 |
496 } // namespace extensions | 484 } // namespace extensions |
OLD | NEW |