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