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

Side by Side Diff: chrome/browser/themes/theme_service.h

Issue 19462009: [DRAFT] Allow a user to revert to their previous theme without closing infobar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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_THEMES_THEME_SERVICE_H_ 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_H_
6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h"
16 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
17 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 18 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
18 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
20 #include "ui/base/theme_provider.h" 21 #include "ui/base/theme_provider.h"
21 22
22 class BrowserThemePack; 23 class BrowserThemePack;
23 class ThemeServiceTest; 24 class ThemeServiceTest;
24 class ThemeSyncableService; 25 class ThemeSyncableService;
25 class Profile; 26 class Profile;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 // This class needs to keep track of the number of theme infobars so that we 127 // This class needs to keep track of the number of theme infobars so that we
127 // clean up unused themes. 128 // clean up unused themes.
128 void OnInfobarDisplayed(); 129 void OnInfobarDisplayed();
129 130
130 // Decrements the number of theme infobars. If the last infobar has been 131 // Decrements the number of theme infobars. If the last infobar has been
131 // destroyed, uninstalls all themes that aren't the currently selected. 132 // destroyed, uninstalls all themes that aren't the currently selected.
132 void OnInfobarDestroyed(); 133 void OnInfobarDestroyed();
133 134
134 // Remove preference values for themes that are no longer in use. 135 // Remove preference values for themes that are no longer in use.
135 void RemoveUnusedThemes(); 136 // |ignore_infobars| is whether unused themes should be removed despite
137 // a theme infobar being visible.
138 void RemoveUnusedThemes(bool ignore_infobars);
136 139
137 // Returns the syncable service for syncing theme. The returned service is 140 // Returns the syncable service for syncing theme. The returned service is
138 // owned by |this| object. 141 // owned by |this| object.
139 virtual ThemeSyncableService* GetThemeSyncableService() const; 142 virtual ThemeSyncableService* GetThemeSyncableService() const;
140 143
141 // Save the images to be written to disk, mapping file path to id. 144 // Save the images to be written to disk, mapping file path to id.
142 typedef std::map<base::FilePath, int> ImagesDiskCache; 145 typedef std::map<base::FilePath, int> ImagesDiskCache;
143 146
144 protected: 147 protected:
145 // Get the specified tint - |id| is one of the TINT_* enum values. 148 // Get the specified tint - |id| is one of the TINT_* enum values.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // True if the theme service is ready to be used. 216 // True if the theme service is ready to be used.
214 // TODO(pkotwicz): Add DCHECKS to the theme service's getters once 217 // TODO(pkotwicz): Add DCHECKS to the theme service's getters once
215 // ThemeSource no longer uses the ThemeService when it is not ready. 218 // ThemeSource no longer uses the ThemeService when it is not ready.
216 bool ready_; 219 bool ready_;
217 220
218 scoped_refptr<BrowserThemePack> theme_pack_; 221 scoped_refptr<BrowserThemePack> theme_pack_;
219 222
220 // The number of infobars currently displayed. 223 // The number of infobars currently displayed.
221 int number_of_infobars_; 224 int number_of_infobars_;
222 225
226 // The id of the theme extension which has just been installed but has not
227 // been loaded yet. The theme extension with |installed_pending_load_id_| may
228 // never be loaded if the install is due to updating a disabled theme.
229 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no
230 // recently installed theme extensions
231 std::string installed_pending_load_id_;
232
223 content::NotificationRegistrar registrar_; 233 content::NotificationRegistrar registrar_;
224 234
225 scoped_ptr<ThemeSyncableService> theme_syncable_service_; 235 scoped_ptr<ThemeSyncableService> theme_syncable_service_;
226 236
237 base::WeakPtrFactory<ThemeService> weak_ptr_factory_;
238
227 DISALLOW_COPY_AND_ASSIGN(ThemeService); 239 DISALLOW_COPY_AND_ASSIGN(ThemeService);
228 }; 240 };
229 241
230 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ 242 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698