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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/pending_extension_manager.h" | 8 #include "chrome/browser/extensions/pending_extension_manager.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, | 54 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, |
55 bool install_silently) { | 55 bool install_silently) { |
56 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 56 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
57 | 57 |
58 if (service_.GetInstalledExtension(id)) { | 58 if (service_.GetInstalledExtension(id)) { |
59 LOG(ERROR) << "Trying to add pending extension " << id | 59 LOG(ERROR) << "Trying to add pending extension " << id |
60 << " which already exists"; | 60 << " which already exists"; |
61 return false; | 61 return false; |
62 } | 62 } |
63 | 63 |
| 64 // Make sure we don't ever try to install the CWS app, because even though |
| 65 // it is listed as a syncable app (because its values need to be synced) it |
| 66 // should already be installed on every instance. |
| 67 if (id == extension_misc::kWebStoreAppId) { |
| 68 NOTREACHED(); |
| 69 return false; |
| 70 } |
| 71 |
64 const bool kIsFromSync = true; | 72 const bool kIsFromSync = true; |
65 const Extension::Location kSyncLocation = Extension::INTERNAL; | 73 const Extension::Location kSyncLocation = Extension::INTERNAL; |
66 | 74 |
67 return AddExtensionImpl(id, update_url, should_allow_install, | 75 return AddExtensionImpl(id, update_url, should_allow_install, |
68 kIsFromSync, install_silently, kSyncLocation); | 76 kIsFromSync, install_silently, kSyncLocation); |
69 } | 77 } |
70 | 78 |
71 bool PendingExtensionManager::AddFromExternalUpdateUrl( | 79 bool PendingExtensionManager::AddFromExternalUpdateUrl( |
72 const std::string& id, const GURL& update_url, | 80 const std::string& id, const GURL& update_url, |
73 Extension::Location location) { | 81 Extension::Location location) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return true; | 195 return true; |
188 } | 196 } |
189 return false; | 197 return false; |
190 } | 198 } |
191 | 199 |
192 void PendingExtensionManager::AddForTesting( | 200 void PendingExtensionManager::AddForTesting( |
193 const std::string& id, | 201 const std::string& id, |
194 const PendingExtensionInfo& pending_extension_info) { | 202 const PendingExtensionInfo& pending_extension_info) { |
195 pending_extension_map_[id] = pending_extension_info; | 203 pending_extension_map_[id] = pending_extension_info; |
196 } | 204 } |
OLD | NEW |