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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/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 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/options/chromeos/power_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/power_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/resources/grit/ash_resources.h" 9 #include "ash/resources/grit/ash_resources.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 base::Bind(&PowerHandler::UpdatePowerStatus, base::Unretained(this))); 80 base::Bind(&PowerHandler::UpdatePowerStatus, base::Unretained(this)));
81 // Callback to set the power source. 81 // Callback to set the power source.
82 web_ui()->RegisterMessageCallback( 82 web_ui()->RegisterMessageCallback(
83 "setPowerSource", 83 "setPowerSource",
84 base::Bind(&PowerHandler::SetPowerSource, base::Unretained(this))); 84 base::Bind(&PowerHandler::SetPowerSource, base::Unretained(this)));
85 } 85 }
86 86
87 void PowerHandler::OnPowerStatusChanged() { 87 void PowerHandler::OnPowerStatusChanged() {
88 web_ui()->CallJavascriptFunctionUnsafe( 88 web_ui()->CallJavascriptFunctionUnsafe(
89 "options.PowerOverlay.setBatteryStatusText", 89 "options.PowerOverlay.setBatteryStatusText",
90 base::StringValue(GetStatusValue())); 90 base::Value(GetStatusValue()));
91 UpdatePowerSources(); 91 UpdatePowerSources();
92 } 92 }
93 93
94 base::string16 PowerHandler::GetStatusValue() const { 94 base::string16 PowerHandler::GetStatusValue() const {
95 PowerStatus* status = PowerStatus::Get(); 95 PowerStatus* status = PowerStatus::Get();
96 if (!status->IsBatteryPresent()) 96 if (!status->IsBatteryPresent())
97 return base::string16(); 97 return base::string16();
98 98
99 bool charging = status->IsBatteryCharging(); 99 bool charging = status->IsBatteryCharging();
100 bool calculating = status->IsBatteryTimeBeingCalculated(); 100 bool calculating = status->IsBatteryTimeBeingCalculated();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 158 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
159 dict->SetString("id", source.id); 159 dict->SetString("id", source.id);
160 dict->SetInteger("type", source.type); 160 dict->SetInteger("type", source.type);
161 dict->SetString("description", 161 dict->SetString("description",
162 l10n_util::GetStringUTF16(source.description_id)); 162 l10n_util::GetStringUTF16(source.description_id));
163 sources_list.Append(std::move(dict)); 163 sources_list.Append(std::move(dict));
164 } 164 }
165 165
166 web_ui()->CallJavascriptFunctionUnsafe( 166 web_ui()->CallJavascriptFunctionUnsafe(
167 "options.PowerOverlay.setPowerSources", sources_list, 167 "options.PowerOverlay.setPowerSources", sources_list,
168 base::StringValue(status->GetCurrentPowerSourceID()), 168 base::Value(status->GetCurrentPowerSourceID()),
169 base::Value(status->IsUsbChargerConnected()), 169 base::Value(status->IsUsbChargerConnected()),
170 base::Value(status->IsBatteryTimeBeingCalculated())); 170 base::Value(status->IsBatteryTimeBeingCalculated()));
171 } 171 }
172 172
173 } // namespace options 173 } // namespace options
174 } // namespace chromeos 174 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698