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

Side by Side Diff: chrome/browser/extensions/chrome_app_sorting.h

Issue 1254363004: Move ownership of AppSorting from ExtensionPrefs to ExtensionSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "extensions/browser/app_sorting.h" 13 #include "extensions/browser/app_sorting.h"
14 #include "extensions/browser/extension_prefs.h" 14 #include "extensions/browser/extension_prefs.h"
15 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
16 #include "sync/api/string_ordinal.h" 16 #include "sync/api/string_ordinal.h"
17 17
18 class PrefService; 18 class PrefService;
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 class ExtensionScopedPrefs; 22 class ExtensionScopedPrefs;
23 23
24 class ChromeAppSorting : public AppSorting { 24 class ChromeAppSorting : public AppSorting {
25 public: 25 public:
26 explicit ChromeAppSorting(content::BrowserContext* browser_context); 26 explicit ChromeAppSorting(content::BrowserContext* browser_context);
27 ~ChromeAppSorting() override; 27 ~ChromeAppSorting() override;
28 28
29 // AppSorting implementation: 29 // AppSorting implementation:
30 void SetExtensionScopedPrefs(ExtensionScopedPrefs* prefs) override;
31 void CheckExtensionScopedPrefs() const override;
32 void Initialize(const extensions::ExtensionIdList& extension_ids) override; 30 void Initialize(const extensions::ExtensionIdList& extension_ids) override;
not at google - send to devlin 2015/07/29 18:22:03 I'd like to take this off the public interface, an
Marc Treib 2015/07/30 14:04:12 Agreed. I'll do this when the remaining stuff is s
33 void FixNTPOrdinalCollisions() override; 31 void FixNTPOrdinalCollisions() override;
34 void EnsureValidOrdinals( 32 void EnsureValidOrdinals(
35 const std::string& extension_id, 33 const std::string& extension_id,
36 const syncer::StringOrdinal& suggested_page) override; 34 const syncer::StringOrdinal& suggested_page) override;
37 void OnExtensionMoved(const std::string& moved_extension_id, 35 void OnExtensionMoved(const std::string& moved_extension_id,
38 const std::string& predecessor_extension_id, 36 const std::string& predecessor_extension_id,
39 const std::string& successor_extension_id) override; 37 const std::string& successor_extension_id) override;
40 syncer::StringOrdinal GetAppLaunchOrdinal( 38 syncer::StringOrdinal GetAppLaunchOrdinal(
41 const std::string& extension_id) const override; 39 const std::string& extension_id) const override;
42 void SetAppLaunchOrdinal( 40 void SetAppLaunchOrdinal(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Returns |app_launch_ordinal| if it has no collision in the page specified 143 // Returns |app_launch_ordinal| if it has no collision in the page specified
146 // by |page_ordinal|. Otherwise, returns an ordinal after |app_launch_ordinal| 144 // by |page_ordinal|. Otherwise, returns an ordinal after |app_launch_ordinal|
147 // that has no conflict. 145 // that has no conflict.
148 syncer::StringOrdinal ResolveCollision( 146 syncer::StringOrdinal ResolveCollision(
149 const syncer::StringOrdinal& page_ordinal, 147 const syncer::StringOrdinal& page_ordinal,
150 const syncer::StringOrdinal& app_launch_ordinal) const; 148 const syncer::StringOrdinal& app_launch_ordinal) const;
151 149
152 // Returns the number of items in |m| visible on the new tab page. 150 // Returns the number of items in |m| visible on the new tab page.
153 size_t CountItemsVisibleOnNtp(const AppLaunchOrdinalMap& m) const; 151 size_t CountItemsVisibleOnNtp(const AppLaunchOrdinalMap& m) const;
154 152
155 ExtensionScopedPrefs* extension_scoped_prefs_; // Weak, owns this instance.
156 content::BrowserContext* browser_context_; 153 content::BrowserContext* browser_context_;
157 154
158 // A map of all the StringOrdinal page ordinals mapping to the collections of 155 // A map of all the StringOrdinal page ordinals mapping to the collections of
159 // app launch ordinals that exist on that page. This is used for mapping 156 // app launch ordinals that exist on that page. This is used for mapping
160 // StringOrdinals to their Integer equivalent as well as quick lookup of the 157 // StringOrdinals to their Integer equivalent as well as quick lookup of the
161 // any collision of on the NTP (icons with the same page and same app launch 158 // any collision of on the NTP (icons with the same page and same app launch
162 // ordinals). The possiblity of collisions means that a multimap must be used 159 // ordinals). The possiblity of collisions means that a multimap must be used
163 // (although the collisions must all be resolved once all the syncing is 160 // (although the collisions must all be resolved once all the syncing is
164 // done). 161 // done).
165 PageOrdinalMap ntp_ordinal_map_; 162 PageOrdinalMap ntp_ordinal_map_;
166 163
167 // Defines the default ordinals. 164 // Defines the default ordinals.
168 AppOrdinalsMap default_ordinals_; 165 AppOrdinalsMap default_ordinals_;
169 166
170 // Used to construct the default ordinals once when needed instead of on 167 // Used to construct the default ordinals once when needed instead of on
171 // construction when the app order may not have been determined. 168 // construction when the app order may not have been determined.
172 bool default_ordinals_created_; 169 bool default_ordinals_created_;
173 170
174 // The set of extensions that don't appear in the new tab page. 171 // The set of extensions that don't appear in the new tab page.
175 std::set<std::string> ntp_hidden_extensions_; 172 std::set<std::string> ntp_hidden_extensions_;
176 173
177 DISALLOW_COPY_AND_ASSIGN(ChromeAppSorting); 174 DISALLOW_COPY_AND_ASSIGN(ChromeAppSorting);
178 }; 175 };
179 176
180 } // namespace extensions 177 } // namespace extensions
181 178
182 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ 179 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/chrome_app_sorting.cc » ('j') | chrome/browser/extensions/chrome_app_sorting.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698