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

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

Issue 2409743002: Fix force policy installation of the removed pref-installed extension (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.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 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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 static const bool kIsFromSync = false; 187 static const bool kIsFromSync = false;
188 static const bool kRemoteInstall = false; 188 static const bool kRemoteInstall = false;
189 189
190 const Extension* extension = ExtensionRegistry::Get(context_) 190 const Extension* extension = ExtensionRegistry::Get(context_)
191 ->GetExtensionById(id, ExtensionRegistry::EVERYTHING); 191 ->GetExtensionById(id, ExtensionRegistry::EVERYTHING);
192 if (extension && location == Manifest::GetHigherPriorityLocation( 192 if (extension && location == Manifest::GetHigherPriorityLocation(
193 location, extension->location())) { 193 location, extension->location())) {
194 // If the new location has higher priority than the location of an existing 194 // If the new location has higher priority than the location of an existing
195 // extension, let the update process overwrite the existing extension. 195 // extension, let the update process overwrite the existing extension.
196 } else { 196 } else {
197 if (ExtensionPrefs::Get(context_)->IsExternalExtensionUninstalled(id)) 197 // Skip the installation if the extension was removed by the user and it's
198 // not specified to be force-installed through the policy.
199 if (!Manifest::IsPolicyLocation(location) &&
200 ExtensionPrefs::Get(context_)->IsExternalExtensionUninstalled(id)) {
198 return false; 201 return false;
202 }
199 203
200 if (extension) { 204 if (extension) {
201 LOG(DFATAL) << "Trying to add extension " << id 205 LOG(DFATAL) << "Trying to add extension " << id
202 << " by external update, but it is already installed."; 206 << " by external update, but it is already installed.";
203 return false; 207 return false;
204 } 208 }
205 } 209 }
206 210
207 return AddExtensionImpl(id, 211 return AddExtensionImpl(id,
208 install_parameter, 212 install_parameter,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 326
323 return true; 327 return true;
324 } 328 }
325 329
326 void PendingExtensionManager::AddForTesting( 330 void PendingExtensionManager::AddForTesting(
327 const PendingExtensionInfo& pending_extension_info) { 331 const PendingExtensionInfo& pending_extension_info) {
328 pending_extension_list_.push_back(pending_extension_info); 332 pending_extension_list_.push_back(pending_extension_info);
329 } 333 }
330 334
331 } // namespace extensions 335 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698