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/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 const bool kIsFromSync = true; | 115 const bool kIsFromSync = true; |
116 const Manifest::Location kSyncLocation = Manifest::INTERNAL; | 116 const Manifest::Location kSyncLocation = Manifest::INTERNAL; |
117 | 117 |
118 return AddExtensionImpl(id, update_url, Version(), should_allow_install, | 118 return AddExtensionImpl(id, update_url, Version(), should_allow_install, |
119 kIsFromSync, install_silently, kSyncLocation); | 119 kIsFromSync, install_silently, kSyncLocation); |
120 } | 120 } |
121 | 121 |
| 122 bool PendingExtensionManager::AddFromExtensionImport( |
| 123 const std::string& id, |
| 124 const GURL& update_url, |
| 125 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) { |
| 126 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 127 |
| 128 if (service_.GetInstalledExtension(id)) { |
| 129 LOG(ERROR) << "Trying to add pending extension " << id |
| 130 << " which already exists"; |
| 131 return false; |
| 132 } |
| 133 |
| 134 const bool kIsFromSync = false; |
| 135 const bool kInstallSilently = true; |
| 136 const Manifest::Location kManifestLocation = Manifest::INTERNAL; |
| 137 |
| 138 return AddExtensionImpl(id, update_url, Version(), should_allow_install, |
| 139 kIsFromSync, kInstallSilently, kManifestLocation); |
| 140 } |
| 141 |
122 bool PendingExtensionManager::AddFromExternalUpdateUrl( | 142 bool PendingExtensionManager::AddFromExternalUpdateUrl( |
123 const std::string& id, | 143 const std::string& id, |
124 const GURL& update_url, | 144 const GURL& update_url, |
125 Manifest::Location location) { | 145 Manifest::Location location) { |
126 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
127 | 147 |
128 const bool kIsFromSync = false; | 148 const bool kIsFromSync = false; |
129 const bool kInstallSilently = true; | 149 const bool kInstallSilently = true; |
130 | 150 |
131 const Extension* extension = service_.GetInstalledExtension(id); | 151 const Extension* extension = service_.GetInstalledExtension(id); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 264 |
245 return true; | 265 return true; |
246 } | 266 } |
247 | 267 |
248 void PendingExtensionManager::AddForTesting( | 268 void PendingExtensionManager::AddForTesting( |
249 const PendingExtensionInfo& pending_extension_info) { | 269 const PendingExtensionInfo& pending_extension_info) { |
250 pending_extension_list_.push_back(pending_extension_info); | 270 pending_extension_list_.push_back(pending_extension_info); |
251 } | 271 } |
252 | 272 |
253 } // namespace extensions | 273 } // namespace extensions |
OLD | NEW |