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

Side by Side Diff: ash/display/display_change_observer_chromeos.cc

Issue 1540753002: Switch to standard integer types in ash/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arraysize Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/display/display_change_observer_chromeos.h" 5 #include "ash/display/display_change_observer_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (display_states.size() != 2) 157 if (display_states.size() != 2)
158 return ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; 158 return ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
159 DisplayIdPair pair = CreateDisplayIdPair(display_states[0]->display_id(), 159 DisplayIdPair pair = CreateDisplayIdPair(display_states[0]->display_id(),
160 display_states[1]->display_id()); 160 display_states[1]->display_id());
161 DisplayLayout layout = Shell::GetInstance()->display_manager()-> 161 DisplayLayout layout = Shell::GetInstance()->display_manager()->
162 layout_store()->GetRegisteredDisplayLayout(pair); 162 layout_store()->GetRegisteredDisplayLayout(pair);
163 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR : 163 return layout.mirrored ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR :
164 ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; 164 ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
165 } 165 }
166 166
167 bool DisplayChangeObserver::GetResolutionForDisplayId(int64 display_id, 167 bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id,
168 gfx::Size* size) const { 168 gfx::Size* size) const {
169 DisplayMode mode; 169 DisplayMode mode;
170 if (!Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId( 170 if (!Shell::GetInstance()->display_manager()->GetSelectedModeForDisplayId(
171 display_id, &mode)) 171 display_id, &mode))
172 return false; 172 return false;
173 173
174 *size = mode.size; 174 *size = mode.size;
175 return true; 175 return true;
176 } 176 }
177 177
178 void DisplayChangeObserver::OnDisplayModeChanged( 178 void DisplayChangeObserver::OnDisplayModeChanged(
179 const ui::DisplayConfigurator::DisplayStateList& display_states) { 179 const ui::DisplayConfigurator::DisplayStateList& display_states) {
180 UpdateInternalDisplayId(display_states); 180 UpdateInternalDisplayId(display_states);
181 181
182 std::vector<DisplayInfo> displays; 182 std::vector<DisplayInfo> displays;
183 std::set<int64> ids; 183 std::set<int64_t> ids;
184 for (const ui::DisplaySnapshot* state : display_states) { 184 for (const ui::DisplaySnapshot* state : display_states) {
185 const ui::DisplayMode* mode_info = state->current_mode(); 185 const ui::DisplayMode* mode_info = state->current_mode();
186 if (!mode_info) 186 if (!mode_info)
187 continue; 187 continue;
188 188
189 float device_scale_factor = 1.0f; 189 float device_scale_factor = 1.0f;
190 // Sets dpi only if the screen size is not blacklisted. 190 // Sets dpi only if the screen size is not blacklisted.
191 float dpi = ui::IsDisplaySizeBlackListed(state->physical_size()) 191 float dpi = ui::IsDisplaySizeBlackListed(state->physical_size())
192 ? 0 192 ? 0
193 : kInchInMm * mode_info->size().width() / 193 : kInchInMm * mode_info->size().width() /
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 name = l10n_util::GetStringUTF8(IDS_ASH_VIRTUAL_DISPLAY_NAME); 227 name = l10n_util::GetStringUTF8(IDS_ASH_VIRTUAL_DISPLAY_NAME);
228 break; 228 break;
229 default: 229 default:
230 name = state->display_name(); 230 name = state->display_name();
231 } 231 }
232 232
233 if (name.empty()) 233 if (name.empty())
234 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); 234 name = l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME);
235 235
236 bool has_overscan = state->has_overscan(); 236 bool has_overscan = state->has_overscan();
237 int64 id = state->display_id(); 237 int64_t id = state->display_id();
238 ids.insert(id); 238 ids.insert(id);
239 239
240 displays.push_back(DisplayInfo(id, name, has_overscan)); 240 displays.push_back(DisplayInfo(id, name, has_overscan));
241 DisplayInfo& new_info = displays.back(); 241 DisplayInfo& new_info = displays.back();
242 new_info.set_device_scale_factor(device_scale_factor); 242 new_info.set_device_scale_factor(device_scale_factor);
243 new_info.SetBounds(display_bounds); 243 new_info.SetBounds(display_bounds);
244 new_info.set_native(true); 244 new_info.set_native(true);
245 new_info.set_is_aspect_preserving_scaling( 245 new_info.set_is_aspect_preserving_scaling(
246 state->is_aspect_preserving_scaling()); 246 state->is_aspect_preserving_scaling());
247 if (dpi) 247 if (dpi)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 return 1.0f; 299 return 1.0f;
300 } 300 }
301 301
302 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() { 302 void DisplayChangeObserver::OnTouchscreenDeviceConfigurationChanged() {
303 OnDisplayModeChanged( 303 OnDisplayModeChanged(
304 Shell::GetInstance()->display_configurator()->cached_displays()); 304 Shell::GetInstance()->display_configurator()->cached_displays());
305 } 305 }
306 306
307 } // namespace ash 307 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_change_observer_chromeos.h ('k') | ash/display/display_color_manager_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698