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

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

Issue 11968032: Move 'theme' parsing out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ManifestHandler registration in theme_service Created 7 years, 11 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 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_system.h" 14 #include "chrome/browser/extensions/extension_system.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/themes/browser_theme_pack.h" 17 #include "chrome/browser/themes/browser_theme_pack.h"
18 #include "chrome/browser/themes/theme_syncable_service.h" 18 #include "chrome/browser/themes/theme_syncable_service.h"
19 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
20 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/extensions/extension_manifest_constants.h"
22 #include "chrome/common/extensions/manifest_handler.h"
23 #include "chrome/common/extensions/theme_handler.h"
21 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
22 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
23 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
24 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
25 #include "grit/ui_resources.h" 28 #include "grit/ui_resources.h"
26 #include "ui/base/layout.h" 29 #include "ui/base/layout.h"
27 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
28 #include "ui/gfx/image/image_skia.h" 31 #include "ui/gfx/image/image_skia.h"
29 32
30 #if defined(OS_WIN) 33 #if defined(OS_WIN)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (!pack->WriteToDisk(path)) 204 if (!pack->WriteToDisk(path))
202 NOTREACHED() << "Could not write theme pack to disk"; 205 NOTREACHED() << "Could not write theme pack to disk";
203 } 206 }
204 207
205 } // namespace 208 } // namespace
206 209
207 bool ThemeService::IsThemeableImage(int resource_id) { 210 bool ThemeService::IsThemeableImage(int resource_id) {
208 return HasThemeableImage(resource_id); 211 return HasThemeableImage(resource_id);
209 } 212 }
210 213
211 ThemeService::ThemeService() 214 ThemeService::ThemeService()
Yoyo Zhou 2013/01/26 00:54:02 It seems like this would work as is (because of ot
Joe Thomas 2013/01/26 02:05:55 Done.
212 : rb_(ResourceBundle::GetSharedInstance()), 215 : rb_(ResourceBundle::GetSharedInstance()),
213 profile_(NULL), 216 profile_(NULL),
214 number_of_infobars_(0) { 217 number_of_infobars_(0) {
215 // Initialize the themeable image map so we can use it on other threads. 218 // Initialize the themeable image map so we can use it on other threads.
216 HasThemeableImage(0); 219 HasThemeableImage(0);
220
221 // Register the ManifestHandler for parsing 'theme' manifest key.
222 extensions::ManifestHandler::Register(extension_manifest_keys::kTheme,
223 new extensions::ThemeHandler);
217 } 224 }
218 225
219 ThemeService::~ThemeService() { 226 ThemeService::~ThemeService() {
220 FreePlatformCaches(); 227 FreePlatformCaches();
221 } 228 }
222 229
223 void ThemeService::Init(Profile* profile) { 230 void ThemeService::Init(Profile* profile) {
224 DCHECK(CalledOnValidThread()); 231 DCHECK(CalledOnValidThread());
225 profile_ = profile; 232 profile_ = profile;
226 233
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 void ThemeService::OnInfobarDestroyed() { 702 void ThemeService::OnInfobarDestroyed() {
696 number_of_infobars_--; 703 number_of_infobars_--;
697 704
698 if (number_of_infobars_ == 0) 705 if (number_of_infobars_ == 0)
699 RemoveUnusedThemes(); 706 RemoveUnusedThemes();
700 } 707 }
701 708
702 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { 709 ThemeSyncableService* ThemeService::GetThemeSyncableService() const {
703 return theme_syncable_service_.get(); 710 return theme_syncable_service_.get();
704 } 711 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698