Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 | 62 |
| 63 InstalledLoader::~InstalledLoader() { | 63 InstalledLoader::~InstalledLoader() { |
| 64 } | 64 } |
| 65 | 65 |
| 66 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { | 66 void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { |
| 67 std::string error; | 67 std::string error; |
| 68 scoped_refptr<const Extension> extension(NULL); | 68 scoped_refptr<const Extension> extension(NULL); |
| 69 // An explicit check against policy is required to behave correctly during | 69 // An explicit check against policy is required to behave correctly during |
| 70 // startup. This is because extensions that were previously OK might have | 70 // startup. This is because extensions that were previously OK might have |
| 71 // been blacklisted in policy while Chrome was not running. | 71 // been blacklisted in policy while Chrome was not running. |
| 72 if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id, | 72 // This isn't a new extension installation, so it's OK if some extension |
| 73 info.extension_location)) { | 73 // management policy delegates aren't yet registered with the |
| 74 // ExtensionService. Admin policy is handled by the ExtensionPrefs class, | |
| 75 // which is created before the ExtensionService itself, so we have what we | |
| 76 // need here. | |
| 77 if (!extension_service_->extension_management_policy()-> | |
| 78 UserMayInstall(info.extension_id, info.extension_location, std::string(), | |
|
Aaron Boodman
2012/05/17 22:41:06
Maybe the name of this method should be UserMayRun
| |
| 79 NULL)) { | |
| 80 // The error message from UserMayInstall() is not well suited to this UI. | |
|
Aaron Boodman
2012/05/17 22:41:06
Why?
Pam (message me for reviews)
2012/05/18 20:15:15
It is typically IDS_EXTENSION_CANT_INSTALL_POLICY_
| |
| 74 error = errors::kDisabledByPolicy; | 81 error = errors::kDisabledByPolicy; |
| 75 } else if (info.extension_manifest.get()) { | 82 } else if (info.extension_manifest.get()) { |
| 76 extension = Extension::Create( | 83 extension = Extension::Create( |
|
Pam (message me for reviews)
2012/05/18 20:15:15
Is it permissible to Create the extension before c
| |
| 77 info.extension_path, | 84 info.extension_path, |
| 78 info.extension_location, | 85 info.extension_location, |
| 79 *info.extension_manifest, | 86 *info.extension_manifest, |
| 80 GetCreationFlags(&info), | 87 GetCreationFlags(&info), |
| 81 &error); | 88 &error); |
| 82 } else { | 89 } else { |
| 83 error = errors::kManifestUnreadable; | 90 error = errors::kManifestUnreadable; |
| 84 } | 91 } |
| 85 | 92 |
| 86 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by | 93 // Once installed, non-unpacked extensions cannot change their IDs (e.g., by |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 if (extension_prefs_->AllowFileAccess(info->extension_id)) | 302 if (extension_prefs_->AllowFileAccess(info->extension_id)) |
| 296 flags |= Extension::ALLOW_FILE_ACCESS; | 303 flags |= Extension::ALLOW_FILE_ACCESS; |
| 297 if (extension_prefs_->IsFromWebStore(info->extension_id)) | 304 if (extension_prefs_->IsFromWebStore(info->extension_id)) |
| 298 flags |= Extension::FROM_WEBSTORE; | 305 flags |= Extension::FROM_WEBSTORE; |
| 299 if (extension_prefs_->IsFromBookmark(info->extension_id)) | 306 if (extension_prefs_->IsFromBookmark(info->extension_id)) |
| 300 flags |= Extension::FROM_BOOKMARK; | 307 flags |= Extension::FROM_BOOKMARK; |
| 301 return flags; | 308 return flags; |
| 302 } | 309 } |
| 303 | 310 |
| 304 } // namespace extensions | 311 } // namespace extensions |
| OLD | NEW |