OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/power_manager_client.h" | 5 #include "chromeos/dbus/power_manager_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 } | 950 } |
951 | 951 |
952 void SetBrightness(double percent, bool user_initiated) { | 952 void SetBrightness(double percent, bool user_initiated) { |
953 brightness_ = std::min(std::max(0.0, percent), 100.0); | 953 brightness_ = std::min(std::max(0.0, percent), 100.0); |
954 int brightness_level = static_cast<int>(brightness_); | 954 int brightness_level = static_cast<int>(brightness_); |
955 FOR_EACH_OBSERVER(Observer, observers_, | 955 FOR_EACH_OBSERVER(Observer, observers_, |
956 BrightnessChanged(brightness_level, user_initiated)); | 956 BrightnessChanged(brightness_level, user_initiated)); |
957 } | 957 } |
958 | 958 |
959 void ParseCommandLineSwitch() { | 959 void ParseCommandLineSwitch() { |
960 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 960 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
961 if (!command_line || !command_line->HasSwitch(switches::kPowerStub)) | 961 if (!command_line || !command_line->HasSwitch(switches::kPowerStub)) |
962 return; | 962 return; |
963 std::string option_str = | 963 std::string option_str = |
964 command_line->GetSwitchValueASCII(switches::kPowerStub); | 964 command_line->GetSwitchValueASCII(switches::kPowerStub); |
965 base::StringPairs string_pairs; | 965 base::StringPairs string_pairs; |
966 base::SplitStringIntoKeyValuePairs(option_str, '=', ',', &string_pairs); | 966 base::SplitStringIntoKeyValuePairs(option_str, '=', ',', &string_pairs); |
967 for (base::StringPairs::iterator iter = string_pairs.begin(); | 967 for (base::StringPairs::iterator iter = string_pairs.begin(); |
968 iter != string_pairs.end(); ++iter) { | 968 iter != string_pairs.end(); ++iter) { |
969 ParseOption((*iter).first, (*iter).second); | 969 ParseOption((*iter).first, (*iter).second); |
970 } | 970 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 // static | 1007 // static |
1008 PowerManagerClient* PowerManagerClient::Create( | 1008 PowerManagerClient* PowerManagerClient::Create( |
1009 DBusClientImplementationType type) { | 1009 DBusClientImplementationType type) { |
1010 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 1010 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
1011 return new PowerManagerClientImpl(); | 1011 return new PowerManagerClientImpl(); |
1012 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 1012 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
1013 return new PowerManagerClientStubImpl(); | 1013 return new PowerManagerClientStubImpl(); |
1014 } | 1014 } |
1015 | 1015 |
1016 } // namespace chromeos | 1016 } // namespace chromeos |
OLD | NEW |