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

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/device_power_handler.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/settings/chromeos/device_power_handler.h" 5 #include "chrome/browser/ui/webui/settings/chromeos/device_power_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/resources/grit/ash_resources.h" 10 #include "ash/resources/grit/ash_resources.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 base::IntToString16(percent)); 109 base::IntToString16(percent));
110 } 110 }
111 111
112 base::DictionaryValue battery_dict; 112 base::DictionaryValue battery_dict;
113 battery_dict.SetBoolean("charging", charging); 113 battery_dict.SetBoolean("charging", charging);
114 battery_dict.SetBoolean("calculating", calculating); 114 battery_dict.SetBoolean("calculating", calculating);
115 battery_dict.SetInteger("percent", percent); 115 battery_dict.SetInteger("percent", percent);
116 battery_dict.SetString("statusText", status_text); 116 battery_dict.SetString("statusText", status_text);
117 117
118 CallJavascriptFunction("cr.webUIListenerCallback", 118 CallJavascriptFunction("cr.webUIListenerCallback",
119 base::StringValue("battery-status-changed"), 119 base::Value("battery-status-changed"), battery_dict);
120 battery_dict);
121 } 120 }
122 121
123 void PowerHandler::SendPowerSources() { 122 void PowerHandler::SendPowerSources() {
124 base::ListValue sources_list; 123 base::ListValue sources_list;
125 for (const auto& source : power_status_->GetPowerSources()) { 124 for (const auto& source : power_status_->GetPowerSources()) {
126 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 125 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
127 dict->SetString("id", source.id); 126 dict->SetString("id", source.id);
128 dict->SetInteger("type", source.type); 127 dict->SetInteger("type", source.type);
129 dict->SetString("description", 128 dict->SetString("description",
130 l10n_util::GetStringUTF16(source.description_id)); 129 l10n_util::GetStringUTF16(source.description_id));
131 sources_list.Append(std::move(dict)); 130 sources_list.Append(std::move(dict));
132 } 131 }
133 132
134 CallJavascriptFunction( 133 CallJavascriptFunction("cr.webUIListenerCallback",
135 "cr.webUIListenerCallback", base::StringValue("power-sources-changed"), 134 base::Value("power-sources-changed"), sources_list,
136 sources_list, base::StringValue(power_status_->GetCurrentPowerSourceID()), 135 base::Value(power_status_->GetCurrentPowerSourceID()),
137 base::Value(power_status_->IsUsbChargerConnected())); 136 base::Value(power_status_->IsUsbChargerConnected()));
138 } 137 }
139 138
140 } // namespace settings 139 } // namespace settings
141 } // namespace chromeos 140 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698