Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/extensions/pending_extension_manager.cc

Issue 7605001: Extensions installed by policy overrun previously installed extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reviewed, rebased Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
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 const Extension* extension = service_.GetInstalledExtension(id);
78 return; 78 if (extension &&
79 79 location == Extension::GetHigherPriorityLocation(location,
80 if (service_.GetInstalledExtension(id)) { 80 extension->location())) {
81 LOG(DFATAL) << "Trying to add extension " << id 81 // If the new location has higher priority than the location of an existing
82 << " by external update, but it is already installed."; 82 // extension, let the update process overwrite the existing extension.
83 return; 83 } else {
84 if (service_.IsExternalExtensionUninstalled(id)) {
85 return;
86 }
87 if (extension) {
88 LOG(DFATAL) << "Trying to add extension " << id
89 << " by external update, but it is already installed.";
90 return;
91 }
84 } 92 }
85 93
86 AddExtensionImpl(id, update_url, &AlwaysInstall, 94 AddExtensionImpl(id, update_url, &AlwaysInstall,
87 kIsFromSync, kInstallSilently, 95 kIsFromSync, kInstallSilently,
88 location); 96 location);
89 } 97 }
90 98
91 99
92 void PendingExtensionManager::AddFromExternalFile( 100 void PendingExtensionManager::AddFromExternalFile(
93 const std::string& id, 101 const std::string& id,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return true; 157 return true;
150 } 158 }
151 return false; 159 return false;
152 } 160 }
153 161
154 void PendingExtensionManager::AddForTesting( 162 void PendingExtensionManager::AddForTesting(
155 const std::string& id, 163 const std::string& id,
156 const PendingExtensionInfo& pending_extension_info) { 164 const PendingExtensionInfo& pending_extension_info) {
157 pending_extension_map_[id] = pending_extension_info; 165 pending_extension_map_[id] = pending_extension_info;
158 } 166 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698