OLD | NEW |
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 <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 web_ui()->RegisterMessageCallback( | 96 web_ui()->RegisterMessageCallback( |
97 "clearDebugInfo", | 97 "clearDebugInfo", |
98 base::Bind(&InstantUIMessageHandler::ClearDebugInfo, | 98 base::Bind(&InstantUIMessageHandler::ClearDebugInfo, |
99 base::Unretained(this))); | 99 base::Unretained(this))); |
100 } | 100 } |
101 | 101 |
102 void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) { | 102 void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) { |
103 std::string pref_name; | 103 std::string pref_name; |
104 if (!args->GetString(0, &pref_name)) return; | 104 if (!args->GetString(0, &pref_name)) return; |
105 | 105 |
106 base::StringValue pref_name_value(pref_name); | 106 base::Value pref_name_value(pref_name); |
107 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) { | 107 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) { |
108 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 108 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
109 base::StringValue arg(prefs->GetString(pref_name.c_str())); | 109 base::Value arg(prefs->GetString(pref_name.c_str())); |
110 web_ui()->CallJavascriptFunctionUnsafe( | 110 web_ui()->CallJavascriptFunctionUnsafe( |
111 "instantConfig.getPreferenceValueResult", pref_name_value, arg); | 111 "instantConfig.getPreferenceValueResult", pref_name_value, arg); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 void InstantUIMessageHandler::SetPreferenceValue(const base::ListValue* args) { | 115 void InstantUIMessageHandler::SetPreferenceValue(const base::ListValue* args) { |
116 std::string pref_name; | 116 std::string pref_name; |
117 if (!args->GetString(0, &pref_name)) return; | 117 if (!args->GetString(0, &pref_name)) return; |
118 | 118 |
119 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) { | 119 if (pref_name == prefs::kInstantUIZeroSuggestUrlPrefix) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Profile* profile = Profile::FromWebUI(web_ui); | 180 Profile* profile = Profile::FromWebUI(web_ui); |
181 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); | 181 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); |
182 } | 182 } |
183 | 183 |
184 // static | 184 // static |
185 void InstantUI::RegisterProfilePrefs( | 185 void InstantUI::RegisterProfilePrefs( |
186 user_prefs::PrefRegistrySyncable* registry) { | 186 user_prefs::PrefRegistrySyncable* registry) { |
187 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, | 187 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, |
188 std::string()); | 188 std::string()); |
189 } | 189 } |
OLD | NEW |