| 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> |
| 10 #include <utility> |
| 11 |
| 9 #include "base/bind.h" | 12 #include "base/bind.h" |
| 10 #include "base/macros.h" | 13 #include "base/macros.h" |
| 11 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 13 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_instant_controller.h" | 20 #include "chrome/browser/ui/browser_instant_controller.h" |
| 18 #include "chrome/browser/ui/search/instant_controller.h" | 21 #include "chrome/browser/ui/search/instant_controller.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 if (!browser || !browser->instant_controller()) | 132 if (!browser || !browser->instant_controller()) |
| 130 return; | 133 return; |
| 131 | 134 |
| 132 InstantController* instant = browser->instant_controller()->instant(); | 135 InstantController* instant = browser->instant_controller()->instant(); |
| 133 const std::list<DebugEvent>& events = instant->debug_events(); | 136 const std::list<DebugEvent>& events = instant->debug_events(); |
| 134 | 137 |
| 135 base::DictionaryValue data; | 138 base::DictionaryValue data; |
| 136 base::ListValue* entries = new base::ListValue(); | 139 base::ListValue* entries = new base::ListValue(); |
| 137 for (std::list<DebugEvent>::const_iterator it = events.begin(); | 140 for (std::list<DebugEvent>::const_iterator it = events.begin(); |
| 138 it != events.end(); ++it) { | 141 it != events.end(); ++it) { |
| 139 base::DictionaryValue* entry = new base::DictionaryValue(); | 142 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); |
| 140 entry->SetString("time", FormatTime(it->first)); | 143 entry->SetString("time", FormatTime(it->first)); |
| 141 entry->SetString("text", it->second); | 144 entry->SetString("text", it->second); |
| 142 entries->Append(entry); | 145 entries->Append(std::move(entry)); |
| 143 } | 146 } |
| 144 data.Set("entries", entries); | 147 data.Set("entries", entries); |
| 145 | 148 |
| 146 web_ui()->CallJavascriptFunctionUnsafe("instantConfig.getDebugInfoResult", | 149 web_ui()->CallJavascriptFunctionUnsafe("instantConfig.getDebugInfoResult", |
| 147 data); | 150 data); |
| 148 #endif | 151 #endif |
| 149 } | 152 } |
| 150 | 153 |
| 151 void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) { | 154 void InstantUIMessageHandler::ClearDebugInfo(const base::ListValue* args) { |
| 152 #if !defined(OS_ANDROID) | 155 #if !defined(OS_ANDROID) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 173 Profile* profile = Profile::FromWebUI(web_ui); | 176 Profile* profile = Profile::FromWebUI(web_ui); |
| 174 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); | 177 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); |
| 175 } | 178 } |
| 176 | 179 |
| 177 // static | 180 // static |
| 178 void InstantUI::RegisterProfilePrefs( | 181 void InstantUI::RegisterProfilePrefs( |
| 179 user_prefs::PrefRegistrySyncable* registry) { | 182 user_prefs::PrefRegistrySyncable* registry) { |
| 180 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, | 183 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, |
| 181 std::string()); | 184 std::string()); |
| 182 } | 185 } |
| OLD | NEW |