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

Side by Side Diff: chrome/browser/ui/webui/theme_handler.cc

Issue 2826643002: Convert Incognito New Tab Page from i18n-* (JS) to $i18n{} (C++) (Closed)
Patch Set: todo Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | ui/base/webui/web_ui_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/ui/webui/theme_handler.h" 5 #include "chrome/browser/ui/webui/theme_handler.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 23 matching lines...) Expand all
34 ThemeServiceFactory::GetForProfile(GetProfile()))); 34 ThemeServiceFactory::GetForProfile(GetProfile())));
35 } 35 }
36 36
37 void ThemeHandler::Observe(int type, 37 void ThemeHandler::Observe(int type,
38 const content::NotificationSource& source, 38 const content::NotificationSource& source,
39 const content::NotificationDetails& details) { 39 const content::NotificationDetails& details) {
40 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); 40 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
41 InitializeCSSCaches(); 41 InitializeCSSCaches();
42 bool has_custom_bg = ThemeService::GetThemeProviderForProfile(GetProfile()) 42 bool has_custom_bg = ThemeService::GetThemeProviderForProfile(GetProfile())
43 .HasCustomImage(IDR_THEME_NTP_BACKGROUND); 43 .HasCustomImage(IDR_THEME_NTP_BACKGROUND);
44 // TODO(dbeam): why does this need to be a dictionary?
44 base::DictionaryValue dictionary; 45 base::DictionaryValue dictionary;
45 dictionary.SetBoolean("hasCustomBackground", has_custom_bg); 46 dictionary.SetBoolean("hasCustomBackground", has_custom_bg);
46 web_ui()->CallJavascriptFunctionUnsafe("ntp.themeChanged", dictionary); 47 web_ui()->CallJavascriptFunctionUnsafe("ntp.themeChanged", dictionary);
47 } 48 }
48 49
49 void ThemeHandler::InitializeCSSCaches() { 50 void ThemeHandler::InitializeCSSCaches() {
50 Profile* profile = GetProfile(); 51 Profile* profile = GetProfile();
51 ThemeSource* theme = new ThemeSource(profile); 52 ThemeSource* theme = new ThemeSource(profile);
52 content::URLDataSource::Add(profile, theme); 53 content::URLDataSource::Add(profile, theme);
53 } 54 }
54 55
55 Profile* ThemeHandler::GetProfile() const { 56 Profile* ThemeHandler::GetProfile() const {
56 return Profile::FromWebUI(web_ui()); 57 return Profile::FromWebUI(web_ui());
57 } 58 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | ui/base/webui/web_ui_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698