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

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

Issue 397903002: Do not assign launch ordinals to ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ephemapp_unload_review
Patch Set: Created 6 years, 5 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 ExtensionSyncService; 18 class ExtensionSyncService;
19 class PrefService; 19 class PrefService;
20 class Profile;
20 21
21 namespace extensions { 22 namespace extensions {
22 23
23 class ExtensionScopedPrefs; 24 class ExtensionScopedPrefs;
24 25
25 class ChromeAppSorting : public AppSorting { 26 class ChromeAppSorting : public AppSorting {
26 public: 27 public:
27 ChromeAppSorting(); 28 ChromeAppSorting();
28 virtual ~ChromeAppSorting(); 29 virtual ~ChromeAppSorting();
29 30
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Returns |app_launch_ordinal| if it has no collision in the page specified 150 // Returns |app_launch_ordinal| if it has no collision in the page specified
150 // by |page_ordinal|. Otherwise, returns an ordinal after |app_launch_ordinal| 151 // by |page_ordinal|. Otherwise, returns an ordinal after |app_launch_ordinal|
151 // that has no conflict. 152 // that has no conflict.
152 syncer::StringOrdinal ResolveCollision( 153 syncer::StringOrdinal ResolveCollision(
153 const syncer::StringOrdinal& page_ordinal, 154 const syncer::StringOrdinal& page_ordinal,
154 const syncer::StringOrdinal& app_launch_ordinal) const; 155 const syncer::StringOrdinal& app_launch_ordinal) const;
155 156
156 // Returns the number of items in |m| visible on the new tab page. 157 // Returns the number of items in |m| visible on the new tab page.
157 size_t CountItemsVisibleOnNtp(const AppLaunchOrdinalMap& m) const; 158 size_t CountItemsVisibleOnNtp(const AppLaunchOrdinalMap& m) const;
158 159
160 Profile* profile_;
159 ExtensionScopedPrefs* extension_scoped_prefs_; // Weak, owns this instance. 161 ExtensionScopedPrefs* extension_scoped_prefs_; // Weak, owns this instance.
160 ExtensionSyncService* extension_sync_service_; // Weak. 162 ExtensionSyncService* extension_sync_service_; // Weak.
161 163
162 // A map of all the StringOrdinal page ordinals mapping to the collections of 164 // A map of all the StringOrdinal page ordinals mapping to the collections of
163 // app launch ordinals that exist on that page. This is used for mapping 165 // app launch ordinals that exist on that page. This is used for mapping
164 // StringOrdinals to their Integer equivalent as well as quick lookup of the 166 // StringOrdinals to their Integer equivalent as well as quick lookup of the
165 // any collision of on the NTP (icons with the same page and same app launch 167 // any collision of on the NTP (icons with the same page and same app launch
166 // ordinals). The possiblity of collisions means that a multimap must be used 168 // ordinals). The possiblity of collisions means that a multimap must be used
167 // (although the collisions must all be resolved once all the syncing is 169 // (although the collisions must all be resolved once all the syncing is
168 // done). 170 // done).
169 PageOrdinalMap ntp_ordinal_map_; 171 PageOrdinalMap ntp_ordinal_map_;
170 172
171 // Defines the default ordinals. 173 // Defines the default ordinals.
172 AppOrdinalsMap default_ordinals_; 174 AppOrdinalsMap default_ordinals_;
173 175
174 // Used to construct the default ordinals once when needed instead of on 176 // Used to construct the default ordinals once when needed instead of on
175 // construction when the app order may not have been determined. 177 // construction when the app order may not have been determined.
176 bool default_ordinals_created_; 178 bool default_ordinals_created_;
177 179
178 // The set of extensions that don't appear in the new tab page. 180 // The set of extensions that don't appear in the new tab page.
179 std::set<std::string> ntp_hidden_extensions_; 181 std::set<std::string> ntp_hidden_extensions_;
180 182
181 DISALLOW_COPY_AND_ASSIGN(ChromeAppSorting); 183 DISALLOW_COPY_AND_ASSIGN(ChromeAppSorting);
182 }; 184 };
183 185
184 } // namespace extensions 186 } // namespace extensions
185 187
186 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_ 188 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_APP_SORTING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698