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

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

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 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 25 matching lines...) Expand all
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 base::DictionaryValue dictionary; 44 base::DictionaryValue dictionary;
45 dictionary.SetBoolean("hasCustomBackground", has_custom_bg); 45 dictionary.SetBoolean("hasCustomBackground", has_custom_bg);
46 web_ui()->CallJavascriptFunction("ntp.themeChanged", dictionary); 46 web_ui()->CallJavascriptFunctionUnsafe("ntp.themeChanged", dictionary);
47 } 47 }
48 48
49 void ThemeHandler::InitializeCSSCaches() { 49 void ThemeHandler::InitializeCSSCaches() {
50 Profile* profile = GetProfile(); 50 Profile* profile = GetProfile();
51 ThemeSource* theme = new ThemeSource(profile); 51 ThemeSource* theme = new ThemeSource(profile);
52 content::URLDataSource::Add(profile, theme); 52 content::URLDataSource::Add(profile, theme);
53 } 53 }
54 54
55 Profile* ThemeHandler::GetProfile() const { 55 Profile* ThemeHandler::GetProfile() const {
56 return Profile::FromWebUI(web_ui()); 56 return Profile::FromWebUI(web_ui());
57 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698