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

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

Issue 2853113004: chromeos: Add settings to control power management prefs. (Closed)
Patch Set: re-add some code Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/md_settings_ui.h" 5 #include "chrome/browser/ui/webui/settings/md_settings_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 html_source->AddBoolean( 183 html_source->AddBoolean(
184 "pinUnlockEnabled", 184 "pinUnlockEnabled",
185 chromeos::quick_unlock::IsPinEnabled(profile->GetPrefs())); 185 chromeos::quick_unlock::IsPinEnabled(profile->GetPrefs()));
186 html_source->AddBoolean("fingerprintUnlockEnabled", 186 html_source->AddBoolean("fingerprintUnlockEnabled",
187 chromeos::quick_unlock::IsFingerprintEnabled()); 187 chromeos::quick_unlock::IsFingerprintEnabled());
188 html_source->AddBoolean("androidAppsAllowed", 188 html_source->AddBoolean("androidAppsAllowed",
189 arc::IsArcAllowedForProfile(profile) && 189 arc::IsArcAllowedForProfile(profile) &&
190 !arc::IsArcOptInVerificationDisabled()); 190 !arc::IsArcOptInVerificationDisabled());
191 191
192 // TODO(mash): Support Chrome power settings in Mash. crbug.com/644348 192 // TODO(mash): Support Chrome power settings in Mash. crbug.com/644348
193 bool enable_power_settings = 193 bool enable_power_settings = !ash_util::IsRunningInMash();
194 !ash_util::IsRunningInMash() &&
195 (switches::PowerOverlayEnabled() ||
196 (ash::PowerStatus::Get()->IsBatteryPresent() &&
197 ash::PowerStatus::Get()->SupportsDualRoleDevices()));
198 html_source->AddBoolean("enablePowerSettings", enable_power_settings); 194 html_source->AddBoolean("enablePowerSettings", enable_power_settings);
199 if (enable_power_settings) { 195 if (enable_power_settings) {
200 AddSettingsPageUIHandler( 196 AddSettingsPageUIHandler(base::MakeUnique<chromeos::settings::PowerHandler>(
201 base::MakeUnique<chromeos::settings::PowerHandler>()); 197 profile->GetPrefs()));
202 } 198 }
203 #endif 199 #endif
204 200
205 AddSettingsPageUIHandler( 201 AddSettingsPageUIHandler(
206 base::WrapUnique(AboutHandler::Create(html_source, profile))); 202 base::WrapUnique(AboutHandler::Create(html_source, profile)));
207 AddSettingsPageUIHandler( 203 AddSettingsPageUIHandler(
208 base::WrapUnique(ResetSettingsHandler::Create(html_source, profile))); 204 base::WrapUnique(ResetSettingsHandler::Create(html_source, profile)));
209 205
210 // Add the metrics handler to write uma stats. 206 // Add the metrics handler to write uma stats.
211 web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>()); 207 web_ui->AddMessageHandler(base::MakeUnique<MetricsHandler>());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD", 252 UMA_HISTOGRAM_TIMES("Settings.LoadDocumentTime.MD",
257 base::Time::Now() - load_start_time_); 253 base::Time::Now() - load_start_time_);
258 } 254 }
259 255
260 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() { 256 void MdSettingsUI::DocumentOnLoadCompletedInMainFrame() {
261 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD", 257 UMA_HISTOGRAM_TIMES("Settings.LoadCompletedTime.MD",
262 base::Time::Now() - load_start_time_); 258 base::Time::Now() - load_start_time_);
263 } 259 }
264 260
265 } // namespace settings 261 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698