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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
120 std::string value; | 120 std::string value; |
121 if (!args->GetString(1, &value)) | 121 if (!args->GetString(1, &value)) |
122 return; | 122 return; |
123 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 123 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
124 prefs->SetString(pref_name.c_str(), value); | 124 prefs->SetString(pref_name, value); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 void InstantUIMessageHandler::GetDebugInfo(const base::ListValue* args) { | 128 void InstantUIMessageHandler::GetDebugInfo(const base::ListValue* args) { |
129 #if !defined(OS_ANDROID) | 129 #if !defined(OS_ANDROID) |
130 typedef std::pair<int64_t, std::string> DebugEvent; | 130 typedef std::pair<int64_t, std::string> DebugEvent; |
131 | 131 |
132 if (!web_ui()->GetWebContents()) | 132 if (!web_ui()->GetWebContents()) |
133 return; | 133 return; |
134 Browser* browser = chrome::FindBrowserWithWebContents( | 134 Browser* browser = chrome::FindBrowserWithWebContents( |
(...skipping 45 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 |