OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 | 61 |
62 const bool kIsFromSync = true; | 62 const bool kIsFromSync = true; |
63 const Extension::Location kSyncLocation = Extension::INTERNAL; | 63 const Extension::Location kSyncLocation = Extension::INTERNAL; |
64 | 64 |
65 return AddExtensionImpl(id, update_url, should_allow_install, | 65 return AddExtensionImpl(id, update_url, should_allow_install, |
66 kIsFromSync, install_silently, kSyncLocation); | 66 kIsFromSync, install_silently, kSyncLocation); |
67 } | 67 } |
68 | 68 |
69 void PendingExtensionManager::AddFromExternalUpdateUrl( | 69 void PendingExtensionManager::AddFromExternalUpdateUrl( |
70 const std::string& id, const GURL& update_url, | 70 const std::string& id, const GURL& update_url, |
71 Extension::Location location) { | 71 Extension::Location location, bool overwrite) { |
Sam Kerner (Chrome)
2011/08/10 17:21:09
There are two reasons |overwrite| is useful:
1) T
Joao da Silva
2011/08/11 10:03:23
Done.
| |
72 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 72 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
73 | 73 |
74 const bool kIsFromSync = false; | 74 const bool kIsFromSync = false; |
75 const bool kInstallSilently = true; | 75 const bool kInstallSilently = true; |
76 | 76 |
77 if (service_.IsExternalExtensionUninstalled(id)) | 77 if (!overwrite) { |
78 return; | 78 if (service_.IsExternalExtensionUninstalled(id)) { |
79 return; | |
80 } | |
79 | 81 |
80 if (service_.GetInstalledExtension(id)) { | 82 if (service_.GetInstalledExtension(id)) { |
81 LOG(DFATAL) << "Trying to add extension " << id | 83 LOG(DFATAL) << "Trying to add extension " << id |
82 << " by external update, but it is already installed."; | 84 << " by external update, but it is already installed."; |
83 return; | 85 return; |
86 } | |
84 } | 87 } |
85 | 88 |
86 AddExtensionImpl(id, update_url, &AlwaysInstall, | 89 AddExtensionImpl(id, update_url, &AlwaysInstall, |
87 kIsFromSync, kInstallSilently, | 90 kIsFromSync, kInstallSilently, |
88 location); | 91 location); |
89 } | 92 } |
90 | 93 |
91 | 94 |
92 void PendingExtensionManager::AddFromExternalFile( | 95 void PendingExtensionManager::AddFromExternalFile( |
93 const std::string& id, | 96 const std::string& id, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 return true; | 152 return true; |
150 } | 153 } |
151 return false; | 154 return false; |
152 } | 155 } |
153 | 156 |
154 void PendingExtensionManager::AddForTesting( | 157 void PendingExtensionManager::AddForTesting( |
155 const std::string& id, | 158 const std::string& id, |
156 const PendingExtensionInfo& pending_extension_info) { | 159 const PendingExtensionInfo& pending_extension_info) { |
157 pending_extension_map_[id] = pending_extension_info; | 160 pending_extension_map_[id] = pending_extension_info; |
158 } | 161 } |
OLD | NEW |