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

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

Issue 20909002: Correct the flag: is_extension_upgrade, which denote whether the extension is being upgrading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better readability. Created 7 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
« 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 // default extension state to DISABLED when the --disable-extensions flag 1989 // default extension state to DISABLED when the --disable-extensions flag
1990 // is set (http://crbug.com/29067). 1990 // is set (http://crbug.com/29067).
1991 if (!extensions_enabled() && 1991 if (!extensions_enabled() &&
1992 !extension->is_theme() && 1992 !extension->is_theme() &&
1993 extension->location() != Manifest::COMPONENT && 1993 extension->location() != Manifest::COMPONENT &&
1994 !Manifest::IsExternalLocation(extension->location())) { 1994 !Manifest::IsExternalLocation(extension->location())) {
1995 return; 1995 return;
1996 } 1996 }
1997 1997
1998 bool is_extension_upgrade = false; 1998 bool is_extension_upgrade = false;
1999 if (const Extension* old = GetInstalledExtension(extension->id())) { 1999 const Extension* old = GetInstalledExtension(extension->id());
2000 is_extension_upgrade = true; 2000 if (old) {
2001 DCHECK_NE(extension, old);
zhchbin 2013/07/30 01:53:56 As my comment, this DCHECK_NE make no sense becaus
2002 // Other than for unpacked extensions, CrxInstaller should have guaranteed 2001 // Other than for unpacked extensions, CrxInstaller should have guaranteed
2003 // that we aren't downgrading. 2002 // that we aren't downgrading.
2004 if (!Manifest::IsUnpackedLocation(extension->location())) 2003 if (!Manifest::IsUnpackedLocation(extension->location())) {
2005 CHECK_GE(extension->version()->CompareTo(*(old->version())), 0); 2004 int version_compare_result =
2005 extension->version()->CompareTo(*(old->version()));
2006 is_extension_upgrade = version_compare_result > 0;
2007 CHECK_GE(version_compare_result, 0);
2008 }
2006 } 2009 }
2007 SetBeingUpgraded(extension, is_extension_upgrade); 2010 SetBeingUpgraded(extension, is_extension_upgrade);
2008 2011
2009 // The extension is now loaded, remove its data from unloaded extension map. 2012 // The extension is now loaded, remove its data from unloaded extension map.
2010 unloaded_extension_paths_.erase(extension->id()); 2013 unloaded_extension_paths_.erase(extension->id());
2011 2014
2012 // If a terminated extension is loaded, remove it from the terminated list. 2015 // If a terminated extension is loaded, remove it from the terminated list.
2013 UntrackTerminatedExtension(extension->id()); 2016 UntrackTerminatedExtension(extension->id());
2014 2017
2015 // If the extension was disabled for a reload, then enable it. 2018 // If the extension was disabled for a reload, then enable it.
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 } 3073 }
3071 3074
3072 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3075 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3073 update_observers_.AddObserver(observer); 3076 update_observers_.AddObserver(observer);
3074 } 3077 }
3075 3078
3076 void ExtensionService::RemoveUpdateObserver( 3079 void ExtensionService::RemoveUpdateObserver(
3077 extensions::UpdateObserver* observer) { 3080 extensions::UpdateObserver* observer) {
3078 update_observers_.RemoveObserver(observer); 3081 update_observers_.RemoveObserver(observer);
3079 } 3082 }
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