| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/extensions/extension_ordering.h" |
| 6 |
| 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/extensions/extension_prefs.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "chrome/common/extensions/extension.h" |
| 12 |
| 13 ExtensionOrdering::ExtensionOrdering( |
| 14 ExtensionScopedPrefs* extension_scoped_prefs) |
| 15 : extension_scoped_prefs_(extension_scoped_prefs), |
| 16 extension_service_(NULL) { |
| 17 } |
| 18 |
| 19 ExtensionOrdering::~ExtensionOrdering() { |
| 20 } |
| 21 |
| 22 void ExtensionOrdering::SetExtensionService( |
| 23 ExtensionServiceInterface* extension_service) { |
| 24 extension_service_ = extension_service; |
| 25 } |
| 26 |
| 27 void ExtensionOrdering::SyncIfNeeded(const std::string& extension_id) { |
| 28 if (!extension_service_) |
| 29 NOTREACHED(); |
| 30 |
| 31 const extensions::Extension* extension = |
| 32 extension_service_->GetInstalledExtension(extension_id); |
| 33 |
| 34 if (extension) { |
| 35 // It is possible for non-app extensions to have ordinal values, but they |
| 36 // shouldn't so we clear them. |
| 37 if (!extension->is_app()) |
| 38 Erase(extension_id); |
| 39 |
| 40 extension_service_->SyncExtensionChangeIfNeeded(*extension); |
| 41 } |
| 42 } |
| OLD | NEW |