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

Side by Side Diff: ui/display/chromeos/display_util.cc

Issue 1019623002: Remove DisplayState from the public interface for DisplayConfigurator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 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 "ui/display/chromeos/display_util.h" 5 #include "ui/display/chromeos/display_util.h"
6 6
7 #include "base/logging.h"
7 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
9 #include "ui/display/types/display_snapshot.h" 10 #include "ui/display/types/display_snapshot.h"
10 11
11 namespace ui { 12 namespace ui {
12 13
13 std::string DisplayPowerStateToString(chromeos::DisplayPowerState state) { 14 std::string DisplayPowerStateToString(chromeos::DisplayPowerState state) {
14 switch (state) { 15 switch (state) {
15 case chromeos::DISPLAY_POWER_ALL_ON: 16 case chromeos::DISPLAY_POWER_ALL_ON:
16 return "ALL_ON"; 17 return "ALL_ON";
(...skipping 20 matching lines...) Expand all
37 return "DUAL_MIRROR"; 38 return "DUAL_MIRROR";
38 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED: 39 case MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED:
39 return "DUAL_EXTENDED"; 40 return "DUAL_EXTENDED";
40 case MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED: 41 case MULTIPLE_DISPLAY_STATE_MULTI_EXTENDED:
41 return "MULTI_EXTENDED"; 42 return "MULTI_EXTENDED";
42 } 43 }
43 NOTREACHED() << "Unknown state " << state; 44 NOTREACHED() << "Unknown state " << state;
44 return "INVALID"; 45 return "INVALID";
45 } 46 }
46 47
47 int GetDisplayPower( 48 int GetDisplayPower(const std::vector<DisplaySnapshot*>& displays,
48 const std::vector<DisplayConfigurator::DisplayState>& display_states, 49 chromeos::DisplayPowerState state,
49 chromeos::DisplayPowerState state, 50 std::vector<bool>* display_power) {
50 std::vector<bool>* display_power) {
51 int num_on_displays = 0; 51 int num_on_displays = 0;
52 if (display_power) 52 if (display_power)
53 display_power->resize(display_states.size()); 53 display_power->resize(displays.size());
54 54
55 for (size_t i = 0; i < display_states.size(); ++i) { 55 for (size_t i = 0; i < displays.size(); ++i) {
56 bool internal = 56 bool internal = displays[i]->type() == DISPLAY_CONNECTION_TYPE_INTERNAL;
57 display_states[i].display->type() == DISPLAY_CONNECTION_TYPE_INTERNAL;
58 bool on = 57 bool on =
59 state == chromeos::DISPLAY_POWER_ALL_ON || 58 state == chromeos::DISPLAY_POWER_ALL_ON ||
60 (state == chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON && 59 (state == chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON &&
61 !internal) || 60 !internal) ||
62 (state == chromeos::DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && internal); 61 (state == chromeos::DISPLAY_POWER_INTERNAL_ON_EXTERNAL_OFF && internal);
63 if (display_power) 62 if (display_power)
64 (*display_power)[i] = on; 63 (*display_power)[i] = on;
65 if (on) 64 if (on)
66 num_on_displays++; 65 num_on_displays++;
67 } 66 }
68 return num_on_displays; 67 return num_on_displays;
69 } 68 }
70 69
71 } // namespace ui 70 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/display_util.h ('k') | ui/display/chromeos/update_display_configuration_task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698