| 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> |
| 10 | 10 |
| (...skipping 159 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 |