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

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

Issue 7237028: Reinstall extensions if they become policy-controlled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 | « no previous file | 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 "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 linked_ptr<ExternalExtensionProviderInterface>(test_provider)); 403 linked_ptr<ExternalExtensionProviderInterface>(test_provider));
404 } 404 }
405 405
406 void ExtensionService::OnExternalExtensionUpdateUrlFound( 406 void ExtensionService::OnExternalExtensionUpdateUrlFound(
407 const std::string& id, 407 const std::string& id,
408 const GURL& update_url, 408 const GURL& update_url,
409 Extension::Location location) { 409 Extension::Location location) {
410 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 410 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
411 CHECK(Extension::IdIsValid(id)); 411 CHECK(Extension::IdIsValid(id));
412 412
413 if (GetExtensionById(id, true)) { 413 const Extension* extension = GetExtensionById(id, true);
414 // Already installed. Do not change the update URL that the extension set. 414 if (extension) {
415 return; 415 if (location != extension->location() &&
Sam Kerner (Chrome) 2011/06/24 20:03:34 Uninstalling wipes any extension state in localsto
gfeher 2011/06/27 12:59:49 Your comment got me thinking. In the case you desc
Sam Kerner (Chrome) 2011/06/27 14:26:30 Yes, we can't do the right thing here without some
416 location == Extension::EXTERNAL_POLICY_DOWNLOAD) {
417 // Already installed, but not as a policy controlled extension.
418 // Trigger a reainstall to make its location right, and thus disable its
419 // manual uninstall.
420 std::string error;
421 UninstallExtension(extension->id(), false, &error);
422 } else {
423 // Already installed. Do not change the update URL that the extension
424 // set.
425 return;
426 }
416 } 427 }
417 pending_extension_manager()->AddFromExternalUpdateUrl( 428 pending_extension_manager()->AddFromExternalUpdateUrl(
418 id, update_url, location); 429 id, update_url, location);
419 external_extension_url_added_ |= true; 430 external_extension_url_added_ |= true;
420 } 431 }
421 432
422 bool ExtensionService::IsDownloadFromGallery(const GURL& download_url, 433 bool ExtensionService::IsDownloadFromGallery(const GURL& download_url,
423 const GURL& referrer_url) { 434 const GURL& referrer_url) {
424 // Special-case the themes mini-gallery. 435 // Special-case the themes mini-gallery.
425 // TODO(erikkay) When that gallery goes away, remove this code. 436 // TODO(erikkay) When that gallery goes away, remove this code.
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 2441
2431 ExtensionService::NaClModuleInfoList::iterator 2442 ExtensionService::NaClModuleInfoList::iterator
2432 ExtensionService::FindNaClModule(const GURL& url) { 2443 ExtensionService::FindNaClModule(const GURL& url) {
2433 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2444 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2434 iter != nacl_module_list_.end(); ++iter) { 2445 iter != nacl_module_list_.end(); ++iter) {
2435 if (iter->url == url) 2446 if (iter->url == url)
2436 return iter; 2447 return iter;
2437 } 2448 }
2438 return nacl_module_list_.end(); 2449 return nacl_module_list_.end();
2439 } 2450 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698