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

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

Issue 9706017: Remove Ordinals Setters and Getters from ExtensionService (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_EXTENSION_SORTING_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
13 #include "chrome/browser/extensions/extension_prefs.h" 13 #include "chrome/browser/extensions/extension_prefs.h"
14 #include "chrome/common/string_ordinal.h" 14 #include "chrome/common/string_ordinal.h"
15 15
16 class ExtensionScopedPrefs; 16 class ExtensionScopedPrefs;
17 class ExtensionService;
17 18
18 class ExtensionSorting { 19 class ExtensionSorting {
19 public: 20 public:
20 explicit ExtensionSorting(ExtensionScopedPrefs* extension_scoped_prefs, 21 explicit ExtensionSorting(ExtensionScopedPrefs* extension_scoped_prefs,
21 PrefService* pref_service); 22 PrefService* pref_service);
22 ~ExtensionSorting(); 23 ~ExtensionSorting();
23 24
25 // Set up the ExtensionService to inform of changes that require syncing.
26 void SetExtensionService(ExtensionService* extension_service);
27
24 // Properly initialize ExtensionSorting internal values that require 28 // Properly initialize ExtensionSorting internal values that require
25 // |extension_ids|. 29 // |extension_ids|.
26 void Initialize(const ExtensionPrefs::ExtensionIdSet& extension_ids); 30 void Initialize(const ExtensionPrefs::ExtensionIdSet& extension_ids);
27 31
28 // Resolves any conflicts the might be created as a result of syncing that 32 // Resolves any conflicts the might be created as a result of syncing that
29 // results in two icons having the same page and app launch ordinal. After 33 // results in two icons having the same page and app launch ordinal. After
30 // this is called it is guaranteed that there are no collisions of NTP icons. 34 // this is called it is guaranteed that there are no collisions of NTP icons.
31 void FixNTPOrdinalCollisions(); 35 void FixNTPOrdinalCollisions();
32 36
33 // This ensures that the extension has valid ordinals, and if it doesn't then 37 // This ensures that the extension has valid ordinals, and if it doesn't then
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Removes the mapping for |extension_id| with a page ordinal of 132 // Removes the mapping for |extension_id| with a page ordinal of
129 // |page_ordinal| and a app launch ordinal of |app_launch_ordinal|. If there 133 // |page_ordinal| and a app launch ordinal of |app_launch_ordinal|. If there
130 // is not matching map, nothing happens. This works with valid and invalid 134 // is not matching map, nothing happens. This works with valid and invalid
131 // StringOrdinals. 135 // StringOrdinals.
132 void RemoveOrdinalMapping(const std::string& extension_id, 136 void RemoveOrdinalMapping(const std::string& extension_id,
133 const StringOrdinal& page_ordinal, 137 const StringOrdinal& page_ordinal,
134 const StringOrdinal& app_launch_ordinal); 138 const StringOrdinal& app_launch_ordinal);
135 139
136 ExtensionScopedPrefs* extension_scoped_prefs_; // Weak, owns this instance. 140 ExtensionScopedPrefs* extension_scoped_prefs_; // Weak, owns this instance.
137 PrefService* pref_service_; // Weak. 141 PrefService* pref_service_; // Weak.
142 ExtensionService* extension_service_; // Weak.
Aaron Boodman 2012/03/14 18:54:28 Instead of having a direct dependency on Extension
csharp 2012/03/15 17:21:19 Ok, I've changed the dependency. I looked at the t
138 143
139 // A map of all the StringOrdinal page ordinals mapping to the collections of 144 // A map of all the StringOrdinal page ordinals mapping to the collections of
140 // app launch ordinals that exist on that page. This is used for mapping 145 // app launch ordinals that exist on that page. This is used for mapping
141 // StringOrdinals to their Integer equivalent as well as quick lookup of the 146 // StringOrdinals to their Integer equivalent as well as quick lookup of the
142 // any collision of on the NTP (icons with the same page and same app launch 147 // any collision of on the NTP (icons with the same page and same app launch
143 // ordinals). The possiblity of collisions means that a multimap must be used 148 // ordinals). The possiblity of collisions means that a multimap must be used
144 // (although the collisions must all be resolved once all the syncing is 149 // (although the collisions must all be resolved once all the syncing is
145 // done). 150 // done).
146 // The StringOrdinal is the app launch ordinal and the string is the extension 151 // The StringOrdinal is the app launch ordinal and the string is the extension
147 // id. 152 // id.
148 typedef std::multimap< 153 typedef std::multimap<
149 StringOrdinal, std::string, StringOrdinalLessThan> AppLaunchOrdinalMap; 154 StringOrdinal, std::string, StringOrdinalLessThan> AppLaunchOrdinalMap;
150 // The StringOrdinal is the page ordinal and the AppLaunchOrdinalMap is the 155 // The StringOrdinal is the page ordinal and the AppLaunchOrdinalMap is the
151 // contents of that page. 156 // contents of that page.
152 typedef std::map< 157 typedef std::map<
153 StringOrdinal, AppLaunchOrdinalMap, StringOrdinalLessThan> PageOrdinalMap; 158 StringOrdinal, AppLaunchOrdinalMap, StringOrdinalLessThan> PageOrdinalMap;
154 PageOrdinalMap ntp_ordinal_map_; 159 PageOrdinalMap ntp_ordinal_map_;
155 160
156 DISALLOW_COPY_AND_ASSIGN(ExtensionSorting); 161 DISALLOW_COPY_AND_ASSIGN(ExtensionSorting);
157 }; 162 };
158 163
159 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_ 164 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SORTING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698