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/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "base/version.h" | 18 #include "base/version.h" |
19 #include "chrome/browser/app_mode/app_mode_utils.h" | 19 #include "chrome/browser/app_mode/app_mode_utils.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/extensions/external_component_loader.h" | 22 #include "chrome/browser/extensions/external_component_loader.h" |
23 #include "chrome/browser/extensions/external_policy_loader.h" | 23 #include "chrome/browser/extensions/external_policy_loader.h" |
24 #include "chrome/browser/extensions/external_pref_loader.h" | 24 #include "chrome/browser/extensions/external_pref_loader.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "components/crx_file/id_util.h" |
29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
30 #include "extensions/browser/extension_system.h" | 31 #include "extensions/browser/extension_system.h" |
31 #include "extensions/browser/external_provider_interface.h" | 32 #include "extensions/browser/external_provider_interface.h" |
32 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
33 #include "extensions/common/manifest.h" | 34 #include "extensions/common/manifest.h" |
34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
35 | 36 |
36 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
37 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 38 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
38 #include "chrome/browser/chromeos/customization_document.h" | 39 #include "chrome/browser/chromeos/customization_document.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ready_ = true; // Queries for extensions are allowed from this point. | 108 ready_ = true; // Queries for extensions are allowed from this point. |
108 | 109 |
109 // Set of unsupported extensions that need to be deleted from prefs_. | 110 // Set of unsupported extensions that need to be deleted from prefs_. |
110 std::set<std::string> unsupported_extensions; | 111 std::set<std::string> unsupported_extensions; |
111 | 112 |
112 // Notify ExtensionService about all the extensions this provider has. | 113 // Notify ExtensionService about all the extensions this provider has. |
113 for (base::DictionaryValue::Iterator i(*prefs_); !i.IsAtEnd(); i.Advance()) { | 114 for (base::DictionaryValue::Iterator i(*prefs_); !i.IsAtEnd(); i.Advance()) { |
114 const std::string& extension_id = i.key(); | 115 const std::string& extension_id = i.key(); |
115 const base::DictionaryValue* extension = NULL; | 116 const base::DictionaryValue* extension = NULL; |
116 | 117 |
117 if (!Extension::IdIsValid(extension_id)) { | 118 if (!crx_file::id_util::IdIsValid(extension_id)) { |
118 LOG(WARNING) << "Malformed extension dictionary: key " | 119 LOG(WARNING) << "Malformed extension dictionary: key " |
119 << extension_id.c_str() << " is not a valid id."; | 120 << extension_id.c_str() << " is not a valid id."; |
120 continue; | 121 continue; |
121 } | 122 } |
122 | 123 |
123 if (!i.value().GetAsDictionary(&extension)) { | 124 if (!i.value().GetAsDictionary(&extension)) { |
124 LOG(WARNING) << "Malformed extension dictionary: key " | 125 LOG(WARNING) << "Malformed extension dictionary: key " |
125 << extension_id.c_str() | 126 << extension_id.c_str() |
126 << " has a value that is not a dictionary."; | 127 << " has a value that is not a dictionary."; |
127 continue; | 128 continue; |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 service, | 574 service, |
574 new ExternalComponentLoader(profile), | 575 new ExternalComponentLoader(profile), |
575 profile, | 576 profile, |
576 Manifest::INVALID_LOCATION, | 577 Manifest::INVALID_LOCATION, |
577 Manifest::EXTERNAL_COMPONENT, | 578 Manifest::EXTERNAL_COMPONENT, |
578 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 579 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
579 } | 580 } |
580 } | 581 } |
581 | 582 |
582 } // namespace extensions | 583 } // namespace extensions |
OLD | NEW |