Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 22794012: Rename extension_manifest_keys namespace to extensions::manifest_keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/prefs/pref_change_registrar.h" 15 #include "base/prefs/pref_change_registrar.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
22 #include "chrome/common/extensions/extension_file_util.h" 22 #include "chrome/common/extensions/extension_file_util.h"
23 #include "chrome/common/extensions/extension_manifest_constants.h"
24 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
25 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
27 #include "extensions/common/id_util.h" 26 #include "extensions/common/id_util.h"
27 #include "extensions/common/manifest_constants.h"
28 #include "grit/browser_resources.h" 28 #include "grit/browser_resources.h"
29 #include "grit/generated_resources.h" 29 #include "grit/generated_resources.h"
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
32 32
33 #if defined(USE_AURA) 33 #if defined(USE_AURA)
34 #include "grit/keyboard_resources.h" 34 #include "grit/keyboard_resources.h"
35 #include "ui/keyboard/keyboard_util.h" 35 #include "ui/keyboard/keyboard_util.h"
36 #endif 36 #endif
37 37
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 base::FieldTrialList::FindFullName(kWebStoreNameFieldTrialName); 83 base::FieldTrialList::FindFullName(kWebStoreNameFieldTrialName);
84 NameMap::iterator it = names.find(field_trial_name); 84 NameMap::iterator it = names.find(field_trial_name);
85 int string_id = it == names.end() ? names[kStoreControl] : it->second; 85 int string_id = it == names.end() ? names[kStoreControl] : it->second;
86 return l10n_util::GetStringUTF8(string_id); 86 return l10n_util::GetStringUTF8(string_id);
87 } 87 }
88 88
89 std::string GenerateId(const DictionaryValue* manifest, 89 std::string GenerateId(const DictionaryValue* manifest,
90 const base::FilePath& path) { 90 const base::FilePath& path) {
91 std::string raw_key; 91 std::string raw_key;
92 std::string id_input; 92 std::string id_input;
93 CHECK(manifest->GetString(extension_manifest_keys::kPublicKey, &raw_key)); 93 CHECK(manifest->GetString(manifest_keys::kPublicKey, &raw_key));
94 CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input)); 94 CHECK(Extension::ParsePEMKeyBytes(raw_key, &id_input));
95 std::string id = id_util::GenerateId(id_input); 95 std::string id = id_util::GenerateId(id_input);
96 return id; 96 return id;
97 } 97 }
98 98
99 } // namespace 99 } // namespace
100 100
101 ComponentLoader::ComponentExtensionInfo::ComponentExtensionInfo( 101 ComponentLoader::ComponentExtensionInfo::ComponentExtensionInfo(
102 const DictionaryValue* manifest, const base::FilePath& directory) 102 const DictionaryValue* manifest, const base::FilePath& directory)
103 : manifest(manifest), 103 : manifest(manifest),
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 std::string manifest_contents = 295 std::string manifest_contents =
296 ResourceBundle::GetSharedInstance().GetRawDataResource( 296 ResourceBundle::GetSharedInstance().GetRawDataResource(
297 manifest_resource_id).as_string(); 297 manifest_resource_id).as_string();
298 298
299 // The Value is kept for the lifetime of the ComponentLoader. This is 299 // The Value is kept for the lifetime of the ComponentLoader. This is
300 // required in case LoadAll() is called again. 300 // required in case LoadAll() is called again.
301 DictionaryValue* manifest = ParseManifest(manifest_contents); 301 DictionaryValue* manifest = ParseManifest(manifest_contents);
302 302
303 if (manifest) { 303 if (manifest) {
304 // Update manifest to use a proper name. 304 // Update manifest to use a proper name.
305 manifest->SetString(extension_manifest_keys::kName, name); 305 manifest->SetString(manifest_keys::kName, name);
306 Add(manifest, root_directory); 306 Add(manifest, root_directory);
307 } 307 }
308 } 308 }
309 309
310 void ComponentLoader::AddChromeApp() { 310 void ComponentLoader::AddChromeApp() {
311 #if defined(ENABLE_APP_LIST) 311 #if defined(ENABLE_APP_LIST)
312 AddWithName(IDR_CHROME_APP_MANIFEST, 312 AddWithName(IDR_CHROME_APP_MANIFEST,
313 base::FilePath(FILE_PATH_LITERAL("chrome_app")), 313 base::FilePath(FILE_PATH_LITERAL("chrome_app")),
314 l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); 314 l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME));
315 #endif 315 #endif
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { 482 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) {
483 delete component->manifest; 483 delete component->manifest;
484 if (extension_service_->is_ready()) { 484 if (extension_service_->is_ready()) {
485 extension_service_-> 485 extension_service_->
486 UnloadExtension(component->extension_id, 486 UnloadExtension(component->extension_id,
487 extension_misc::UNLOAD_REASON_DISABLE); 487 extension_misc::UNLOAD_REASON_DISABLE);
488 } 488 }
489 } 489 }
490 490
491 } // namespace extensions 491 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/storage/managed_value_store_cache.cc ('k') | chrome/browser/extensions/convert_user_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698