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 16 matching lines...) Expand all Loading... |
27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
28 | 28 |
29 #if defined(OFFICIAL_BUILD) | 29 #if defined(OFFICIAL_BUILD) |
30 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
34 #include "chrome/browser/chromeos/login/user_manager.h" | 34 #include "chrome/browser/chromeos/login/user_manager.h" |
35 #endif | 35 #endif |
36 | 36 |
37 #if defined(USE_ASH) | 37 #if defined(ENABLE_APP_LIST) |
38 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 #endif | 40 #endif |
41 | 41 |
42 namespace extensions { | 42 namespace extensions { |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 static bool enable_background_extensions_during_testing = false; | 46 static bool enable_background_extensions_during_testing = false; |
47 | 47 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 std::string name = | 286 std::string name = |
287 profile_prefs_->GetString(prefs::kEnterpriseWebStoreName); | 287 profile_prefs_->GetString(prefs::kEnterpriseWebStoreName); |
288 manifest->SetString("app.launch.web_url", enterprise_webstore_url); | 288 manifest->SetString("app.launch.web_url", enterprise_webstore_url); |
289 manifest->SetString("name", name); | 289 manifest->SetString("name", name); |
290 Add(manifest, path); | 290 Add(manifest, path); |
291 } | 291 } |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 void ComponentLoader::AddChromeApp() { | 295 void ComponentLoader::AddChromeApp() { |
296 #if defined(USE_ASH) | 296 #if defined(ENABLE_APP_LIST) |
297 std::string manifest_contents = | 297 std::string manifest_contents = |
298 ResourceBundle::GetSharedInstance().GetRawDataResource( | 298 ResourceBundle::GetSharedInstance().GetRawDataResource( |
299 IDR_CHROME_APP_MANIFEST).as_string(); | 299 IDR_CHROME_APP_MANIFEST).as_string(); |
300 | 300 |
301 // The Value is kept for the lifetime of the ComponentLoader. This is | 301 // The Value is kept for the lifetime of the ComponentLoader. This is |
302 // required in case LoadAll() is called again. | 302 // required in case LoadAll() is called again. |
303 DictionaryValue* manifest = ParseManifest(manifest_contents); | 303 DictionaryValue* manifest = ParseManifest(manifest_contents); |
304 | 304 |
305 // Update manifest to use a proper name. | 305 // Update manifest to use a proper name. |
306 manifest->SetString(extension_manifest_keys::kName, | 306 manifest->SetString(extension_manifest_keys::kName, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 if (!skip_session_components) { | 354 if (!skip_session_components) { |
355 Add(IDR_WEBSTORE_MANIFEST, FilePath(FILE_PATH_LITERAL("web_store"))); | 355 Add(IDR_WEBSTORE_MANIFEST, FilePath(FILE_PATH_LITERAL("web_store"))); |
356 | 356 |
357 // If a URL for the enterprise webstore has been specified, load the | 357 // If a URL for the enterprise webstore has been specified, load the |
358 // component extension. This extension might also be loaded later, because | 358 // component extension. This extension might also be loaded later, because |
359 // it is specified by policy, and on ChromeOS policies are loaded after | 359 // it is specified by policy, and on ChromeOS policies are loaded after |
360 // the browser process has started. | 360 // the browser process has started. |
361 AddOrReloadEnterpriseWebStore(); | 361 AddOrReloadEnterpriseWebStore(); |
362 | 362 |
363 #if defined(USE_ASH) | |
364 AddChromeApp(); | 363 AddChromeApp(); |
365 #endif | |
366 } | 364 } |
367 | 365 |
368 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); | 366 AddDefaultComponentExtensionsWithBackgroundPages(skip_session_components); |
369 } | 367 } |
370 | 368 |
371 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( | 369 void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( |
372 bool skip_session_components) { | 370 bool skip_session_components) { |
373 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 371 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
374 | 372 |
375 // Component extensions with background pages are not enabled during tests | 373 // Component extensions with background pages are not enabled during tests |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void ComponentLoader::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 434 void ComponentLoader::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
437 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 435 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
438 std::string() /* default_value */, | 436 std::string() /* default_value */, |
439 PrefServiceSyncable::UNSYNCABLE_PREF); | 437 PrefServiceSyncable::UNSYNCABLE_PREF); |
440 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 438 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
441 std::string() /* default_value */, | 439 std::string() /* default_value */, |
442 PrefServiceSyncable::UNSYNCABLE_PREF); | 440 PrefServiceSyncable::UNSYNCABLE_PREF); |
443 } | 441 } |
444 | 442 |
445 } // namespace extensions | 443 } // namespace extensions |
OLD | NEW |