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

Side by Side Diff: chrome/browser/ui/webui/instant_ui.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) 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/ui/webui/instant_ui.h" 5 #include "chrome/browser/ui/webui/instant_ui.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) { 95 void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) {
96 std::string pref_name; 96 std::string pref_name;
97 if (!args->GetString(0, &pref_name)) return; 97 if (!args->GetString(0, &pref_name)) return;
98 98
99 base::StringValue pref_name_value(pref_name); 99 base::StringValue pref_name_value(pref_name);
100 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) { 100 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) {
101 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 101 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
102 base::StringValue arg(prefs->GetString(pref_name.c_str())); 102 base::StringValue arg(prefs->GetString(pref_name.c_str()));
103 web_ui()->CallJavascriptFunction( 103 web_ui()->CallJavascriptFunctionUnsafe(
104 "instantConfig.getPreferenceValueResult", pref_name_value, arg); 104 "instantConfig.getPreferenceValueResult", pref_name_value, arg);
105 } 105 }
106 } 106 }
107 107
108 void InstantUIMessageHandler::SetPreferenceValue(const base::ListValue* args) { 108 void InstantUIMessageHandler::SetPreferenceValue(const base::ListValue* args) {
109 std::string pref_name; 109 std::string pref_name;
110 if (!args->GetString(0, &pref_name)) return; 110 if (!args->GetString(0, &pref_name)) return;
111 111
112 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) { 112 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) {
113 std::string value; 113 std::string value;
(...skipping 22 matching lines...) Expand all
136 base::ListValue* entries = new base::ListValue(); 136 base::ListValue* entries = new base::ListValue();
137 for (std::list<DebugEvent>::const_iterator it = events.begin(); 137 for (std::list<DebugEvent>::const_iterator it = events.begin();
138 it != events.end(); ++it) { 138 it != events.end(); ++it) {
139 base::DictionaryValue* entry = new base::DictionaryValue(); 139 base::DictionaryValue* entry = new base::DictionaryValue();
140 entry->SetString("time", FormatTime(it->first)); 140 entry->SetString("time", FormatTime(it->first));
141 entry->SetString("text", it->second); 141 entry->SetString("text", it->second);
142 entries->Append(entry); 142 entries->Append(entry);
143 } 143 }
144 data.Set("entries", entries); 144 data.Set("entries", entries);
145 145
146 web_ui()->CallJavascriptFunction("instantConfig.getDebugInfoResult", data); 146 web_ui()->CallJavascriptFunctionUnsafe("instantConfig.getDebugInfoResult",
147 data);
147 #endif 148 #endif
148 } 149 }
149 150
150 void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) { 151 void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) {
151 #if !defined(OS_ANDROID) 152 #if !defined(OS_ANDROID)
152 if (!web_ui()->GetWebContents()) 153 if (!web_ui()->GetWebContents())
153 return; 154 return;
154 Browser* browser = chrome::FindBrowserWithWebContents( 155 Browser* browser = chrome::FindBrowserWithWebContents(
155 web_ui()->GetWebContents()); 156 web_ui()->GetWebContents());
156 if (!browser || !browser->instant_controller()) 157 if (!browser || !browser->instant_controller())
(...skipping 15 matching lines...) Expand all
172 Profile* profile = Profile::FromWebUI(web_ui); 173 Profile* profile = Profile::FromWebUI(web_ui);
173 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); 174 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource());
174 } 175 }
175 176
176 // static 177 // static
177 void InstantUI::RegisterProfilePrefs( 178 void InstantUI::RegisterProfilePrefs(
178 user_prefs::PrefRegistrySyncable* registry) { 179 user_prefs::PrefRegistrySyncable* registry) {
179 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, 180 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix,
180 std::string()); 181 std::string());
181 } 182 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/inspect_ui.cc ('k') | chrome/browser/ui/webui/invalidations_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698