OLD | NEW |
---|---|
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 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 if (const Extension* old = GetInstalledExtension(extension->id())) { |
2000 is_extension_upgrade = true; | |
2001 DCHECK_NE(extension, old); | 2000 DCHECK_NE(extension, old); |
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 CHECK_GE(extension->version()->CompareTo(*(old->version())), 0); |
2005 is_extension_upgrade = | |
2006 extension->version()->CompareTo(*(old->version())) > 0; | |
2007 } | |
asargent_no_longer_on_chrome
2013/07/29 23:09:01
I think this block would read a little better writ
zhchbin
2013/07/30 01:46:41
Note that here is *CHECK_GE*. And is_extension_upg
| |
2006 } | 2008 } |
2007 SetBeingUpgraded(extension, is_extension_upgrade); | 2009 SetBeingUpgraded(extension, is_extension_upgrade); |
2008 | 2010 |
2009 // The extension is now loaded, remove its data from unloaded extension map. | 2011 // The extension is now loaded, remove its data from unloaded extension map. |
2010 unloaded_extension_paths_.erase(extension->id()); | 2012 unloaded_extension_paths_.erase(extension->id()); |
2011 | 2013 |
2012 // If a terminated extension is loaded, remove it from the terminated list. | 2014 // If a terminated extension is loaded, remove it from the terminated list. |
2013 UntrackTerminatedExtension(extension->id()); | 2015 UntrackTerminatedExtension(extension->id()); |
2014 | 2016 |
2015 // If the extension was disabled for a reload, then enable it. | 2017 // If the extension was disabled for a reload, then enable it. |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3070 } | 3072 } |
3071 | 3073 |
3072 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3074 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3073 update_observers_.AddObserver(observer); | 3075 update_observers_.AddObserver(observer); |
3074 } | 3076 } |
3075 | 3077 |
3076 void ExtensionService::RemoveUpdateObserver( | 3078 void ExtensionService::RemoveUpdateObserver( |
3077 extensions::UpdateObserver* observer) { | 3079 extensions::UpdateObserver* observer) { |
3078 update_observers_.RemoveObserver(observer); | 3080 update_observers_.RemoveObserver(observer); |
3079 } | 3081 } |
OLD | NEW |