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/installed_loader.h" | 5 #include "chrome/browser/extensions/installed_loader.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { | 69 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { |
70 std::string error; | 70 std::string error; |
71 scoped_refptr<const Extension> extension(NULL); | 71 scoped_refptr<const Extension> extension(NULL); |
72 if (info.extension_manifest.get()) { | 72 if (info.extension_manifest.get()) { |
73 extension = Extension::Create( | 73 extension = Extension::Create( |
74 info.extension_path, | 74 info.extension_path, |
75 info.extension_location, | 75 info.extension_location, |
76 *info.extension_manifest, | 76 *info.extension_manifest, |
77 GetCreationFlags(&info), | 77 GetCreationFlags(&info), |
78 &error); | 78 &error); |
79 if (extension && | |
Aaron Boodman
2012/08/06 20:36:07
stray edit?
eaugusti
2012/08/17 23:25:01
Done.
| |
80 extension_prefs_->HasUnsupportedRequirements(extension->id())) { | |
81 std::vector<std::string> requirement_errors = | |
82 extension_prefs_->GetUnsupportedRequirements(extension->id()); | |
83 extensions::Extension::InstallWarningVector install_warnings; | |
84 std::vector<std::string>::iterator it; | |
85 for (it = requirement_errors.begin(); it != requirement_errors.end(); | |
86 ++it) { | |
87 install_warnings.push_back(Extension::InstallWarning( | |
88 Extension::InstallWarning::FORMAT_TEXT, *it)); | |
89 } | |
90 const_cast<Extension*>(extension.get())->AddInstallWarnings( | |
91 install_warnings); | |
92 } | |
79 } else { | 93 } else { |
80 error = errors::kManifestUnreadable; | 94 error = errors::kManifestUnreadable; |
81 } | 95 } |
82 | 96 |
83 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by | 97 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by |
84 // updating the 'key' field in their manifest). | 98 // updating the 'key' field in their manifest). |
85 // TODO(jstritar): migrate preferences when unpacked extensions change IDs. | 99 // TODO(jstritar): migrate preferences when unpacked extensions change IDs. |
86 if (extension && | 100 if (extension && |
87 extension->location() != Extension::LOAD && | 101 extension->location() != Extension::LOAD && |
88 info.extension_id != extension->id()) { | 102 info.extension_id != extension->id()) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 316 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
303 flags |= Extension::ALLOW_FILE_ACCESS; | 317 flags |= Extension::ALLOW_FILE_ACCESS; |
304 if (extension_prefs_->IsFromWebStore(info->extension_id)) | 318 if (extension_prefs_->IsFromWebStore(info->extension_id)) |
305 flags |= Extension::FROM_WEBSTORE; | 319 flags |= Extension::FROM_WEBSTORE; |
306 if (extension_prefs_->IsFromBookmark(info->extension_id)) | 320 if (extension_prefs_->IsFromBookmark(info->extension_id)) |
307 flags |= Extension::FROM_BOOKMARK; | 321 flags |= Extension::FROM_BOOKMARK; |
308 return flags; | 322 return flags; |
309 } | 323 } |
310 | 324 |
311 } // namespace extensions | 325 } // namespace extensions |
OLD | NEW |