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

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

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: 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
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 <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return; 133 return;
134 Browser* browser = chrome::FindBrowserWithWebContents( 134 Browser* browser = chrome::FindBrowserWithWebContents(
135 web_ui()->GetWebContents()); 135 web_ui()->GetWebContents());
136 if (!browser || !browser->instant_controller()) 136 if (!browser || !browser->instant_controller())
137 return; 137 return;
138 138
139 InstantController* instant = browser->instant_controller()->instant(); 139 InstantController* instant = browser->instant_controller()->instant();
140 const std::list<DebugEvent>& events = instant->debug_events(); 140 const std::list<DebugEvent>& events = instant->debug_events();
141 141
142 base::DictionaryValue data; 142 base::DictionaryValue data;
143 base::ListValue* entries = new base::ListValue(); 143 auto entries = base::MakeUnique<base::ListValue>();
144 for (std::list<DebugEvent>::const_iterator it = events.begin(); 144 for (std::list<DebugEvent>::const_iterator it = events.begin();
145 it != events.end(); ++it) { 145 it != events.end(); ++it) {
146 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); 146 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
147 entry->SetString("time", FormatTime(it->first)); 147 entry->SetString("time", FormatTime(it->first));
148 entry->SetString("text", it->second); 148 entry->SetString("text", it->second);
149 entries->Append(std::move(entry)); 149 entries->Append(std::move(entry));
150 } 150 }
151 data.Set("entries", entries); 151 data.Set("entries", std::move(entries));
152 152
153 web_ui()->CallJavascriptFunctionUnsafe("instantConfig.getDebugInfoResult", 153 web_ui()->CallJavascriptFunctionUnsafe("instantConfig.getDebugInfoResult",
154 data); 154 data);
155 #endif 155 #endif
156 } 156 }
157 157
158 void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) { 158 void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) {
159 #if !defined(OS_ANDROID) 159 #if !defined(OS_ANDROID)
160 if (!web_ui()->GetWebContents()) 160 if (!web_ui()->GetWebContents())
161 return; 161 return;
(...skipping 18 matching lines...) Expand all
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698