OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/power_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/power_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
jdoerrie
2017/04/13 09:08:51
#include <memory>
vabr (Chromium)
2017/04/13 12:03:14
Done.
| |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/chromeos/power/power_data_collector.h" | 18 #include "chrome/browser/chromeos/power/power_data_collector.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 new base::DictionaryValue); | 170 new base::DictionaryValue); |
171 js_sample->SetDouble("time", sample.time.ToJsTime()); | 171 js_sample->SetDouble("time", sample.time.ToJsTime()); |
172 js_sample->SetBoolean("cpuOnline", sample.cpu_online); | 172 js_sample->SetBoolean("cpuOnline", sample.cpu_online); |
173 | 173 |
174 std::unique_ptr<base::DictionaryValue> state_dict( | 174 std::unique_ptr<base::DictionaryValue> state_dict( |
175 new base::DictionaryValue); | 175 new base::DictionaryValue); |
176 for (size_t index = 0; index < sample.time_in_state.size(); ++index) { | 176 for (size_t index = 0; index < sample.time_in_state.size(); ++index) { |
177 state_dict->SetDouble(state_names[index], | 177 state_dict->SetDouble(state_names[index], |
178 static_cast<double>(sample.time_in_state[index])); | 178 static_cast<double>(sample.time_in_state[index])); |
179 } | 179 } |
180 js_sample->Set("timeInState", state_dict.release()); | 180 js_sample->Set("timeInState", std::move(state_dict)); |
181 | 181 |
182 js_sample_list->Append(std::move(js_sample)); | 182 js_sample_list->Append(std::move(js_sample)); |
183 } | 183 } |
184 js_data->Append(std::move(js_sample_list)); | 184 js_data->Append(std::move(js_sample_list)); |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 } // namespace | 188 } // namespace |
189 | 189 |
190 PowerUI::PowerUI(content::WebUI* web_ui) : content::WebUIController(web_ui) { | 190 PowerUI::PowerUI(content::WebUI* web_ui) : content::WebUIController(web_ui) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 html->SetDefaultResource(IDR_ABOUT_POWER_HTML); | 238 html->SetDefaultResource(IDR_ABOUT_POWER_HTML); |
239 | 239 |
240 Profile* profile = Profile::FromWebUI(web_ui); | 240 Profile* profile = Profile::FromWebUI(web_ui); |
241 content::WebUIDataSource::Add(profile, html); | 241 content::WebUIDataSource::Add(profile, html); |
242 } | 242 } |
243 | 243 |
244 PowerUI::~PowerUI() { | 244 PowerUI::~PowerUI() { |
245 } | 245 } |
246 | 246 |
247 } // namespace chromeos | 247 } // namespace chromeos |
OLD | NEW |