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

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

Issue 17038002: Separate the NTP app ordering from the app list app ordering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698