Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pending_extension_manager.h" | 5 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 } | 84 } |
| 85 | 85 |
| 86 return false; | 86 return false; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool PendingExtensionManager::AddFromSync( | 89 bool PendingExtensionManager::AddFromSync( |
| 90 const std::string& id, | 90 const std::string& id, |
| 91 const GURL& update_url, | 91 const GURL& update_url, |
| 92 const base::Version& version, | 92 const base::Version& version, |
| 93 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, | 93 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, |
| 94 bool remote_install, | 94 bool remote_install) { |
| 95 bool installed_by_custodian) { | |
| 96 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 95 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 97 | 96 |
| 98 if (ExtensionRegistry::Get(context_)->GetExtensionById( | 97 if (ExtensionRegistry::Get(context_)->GetExtensionById( |
| 99 id, ExtensionRegistry::EVERYTHING)) { | 98 id, ExtensionRegistry::EVERYTHING)) { |
| 100 LOG(ERROR) << "Trying to add pending extension " << id | 99 LOG(ERROR) << "Trying to add pending extension " << id |
| 101 << " which already exists"; | 100 << " which already exists"; |
| 102 return false; | 101 return false; |
| 103 } | 102 } |
| 104 | 103 |
| 105 // Make sure we don't ever try to install the CWS app, because even though | 104 // Make sure we don't ever try to install the CWS app, because even though |
| 106 // it is listed as a syncable app (because its values need to be synced) it | 105 // it is listed as a syncable app (because its values need to be synced) it |
| 107 // should already be installed on every instance. | 106 // should already be installed on every instance. |
| 108 if (id == extensions::kWebStoreAppId) { | 107 if (id == extensions::kWebStoreAppId) { |
| 109 NOTREACHED(); | 108 NOTREACHED(); |
| 110 return false; | 109 return false; |
| 111 } | 110 } |
| 112 | 111 |
| 113 int creation_flags = Extension::NO_FLAGS; | 112 int creation_flags = Extension::NO_FLAGS; |
| 114 if (installed_by_custodian) { | |
| 115 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN; | |
| 116 } | |
| 117 | 113 |
| 118 static const bool kIsFromSync = true; | 114 static const bool kIsFromSync = true; |
| 119 static const Manifest::Location kSyncLocation = Manifest::INTERNAL; | 115 static const Manifest::Location kSyncLocation = Manifest::INTERNAL; |
| 120 static const bool kMarkAcknowledged = false; | 116 static const bool kMarkAcknowledged = false; |
| 121 | 117 |
| 122 return AddExtensionImpl(id, | 118 return AddExtensionImpl(id, |
| 123 std::string(), | 119 std::string(), |
| 124 update_url, | 120 update_url, |
| 125 version, | 121 version, |
| 126 should_allow_install, | 122 should_allow_install, |
| 127 kIsFromSync, | 123 kIsFromSync, |
| 128 kSyncLocation, | 124 kSyncLocation, |
| 129 creation_flags, | 125 creation_flags, |
|
Devlin
2016/06/13 14:36:58
I haven't been real thorough, but at first glance
mamir
2016/06/13 15:25:31
That's correct.
I removed it.
Done.
| |
| 130 kMarkAcknowledged, | 126 kMarkAcknowledged, |
| 131 remote_install); | 127 remote_install); |
| 132 } | 128 } |
| 133 | 129 |
| 134 bool PendingExtensionManager::AddFromExtensionImport( | 130 bool PendingExtensionManager::AddFromExtensionImport( |
| 135 const std::string& id, | 131 const std::string& id, |
| 136 const GURL& update_url, | 132 const GURL& update_url, |
| 137 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) { | 133 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) { |
| 138 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 134 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 139 | 135 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 | 304 |
| 309 return true; | 305 return true; |
| 310 } | 306 } |
| 311 | 307 |
| 312 void PendingExtensionManager::AddForTesting( | 308 void PendingExtensionManager::AddForTesting( |
| 313 const PendingExtensionInfo& pending_extension_info) { | 309 const PendingExtensionInfo& pending_extension_info) { |
| 314 pending_extension_list_.push_back(pending_extension_info); | 310 pending_extension_list_.push_back(pending_extension_info); |
| 315 } | 311 } |
| 316 | 312 |
| 317 } // namespace extensions | 313 } // namespace extensions |
| OLD | NEW |