OLD | NEW |
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/resolution_notification_controller.h" | 5 #include "ash/display/resolution_notification_controller.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/system_notifier.h" | 10 #include "ash/system/system_notifier.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 void ResolutionNotificationController::RevertResolutionChange() { | 278 void ResolutionNotificationController::RevertResolutionChange() { |
279 message_center::MessageCenter::Get()->RemoveNotification( | 279 message_center::MessageCenter::Get()->RemoveNotification( |
280 kNotificationId, false /* by_user */); | 280 kNotificationId, false /* by_user */); |
281 int64 display_id = change_info_->display_id; | 281 int64 display_id = change_info_->display_id; |
282 gfx::Size old_resolution = change_info_->old_resolution; | 282 gfx::Size old_resolution = change_info_->old_resolution; |
283 change_info_.reset(); | 283 change_info_.reset(); |
284 Shell::GetInstance()->display_manager()->SetDisplayResolution( | 284 Shell::GetInstance()->display_manager()->SetDisplayResolution( |
285 display_id, old_resolution); | 285 display_id, old_resolution); |
286 } | 286 } |
287 | 287 |
| 288 void ResolutionNotificationController::OnDisplayBoundsChanged( |
| 289 const gfx::Display& display) { |
| 290 } |
| 291 |
288 void ResolutionNotificationController::OnDisplayAdded( | 292 void ResolutionNotificationController::OnDisplayAdded( |
289 const gfx::Display& new_display) { | 293 const gfx::Display& new_display) { |
290 } | 294 } |
291 | 295 |
292 void ResolutionNotificationController::OnDisplayRemoved( | 296 void ResolutionNotificationController::OnDisplayRemoved( |
293 const gfx::Display& old_display) { | 297 const gfx::Display& old_display) { |
294 if (change_info_ && change_info_->display_id == old_display.id()) | 298 if (change_info_ && change_info_->display_id == old_display.id()) |
295 RevertResolutionChange(); | 299 RevertResolutionChange(); |
296 } | 300 } |
297 | 301 |
298 void ResolutionNotificationController::OnDisplayMetricsChanged( | |
299 const gfx::Display&, uint32_t) { | |
300 } | |
301 | |
302 void ResolutionNotificationController::OnDisplayConfigurationChanged() { | 302 void ResolutionNotificationController::OnDisplayConfigurationChanged() { |
303 if (!change_info_) | 303 if (!change_info_) |
304 return; | 304 return; |
305 | 305 |
306 const DisplayInfo& info = Shell::GetInstance()->display_manager()-> | 306 const DisplayInfo& info = Shell::GetInstance()->display_manager()-> |
307 GetDisplayInfo(change_info_->display_id); | 307 GetDisplayInfo(change_info_->display_id); |
308 change_info_->current_resolution = info.bounds_in_native().size(); | 308 change_info_->current_resolution = info.bounds_in_native().size(); |
309 CreateOrUpdateNotification(true); | 309 CreateOrUpdateNotification(true); |
310 if (g_use_timer && change_info_->timeout_count > 0) { | 310 if (g_use_timer && change_info_->timeout_count > 0) { |
311 change_info_->timer.Start(FROM_HERE, | 311 change_info_->timer.Start(FROM_HERE, |
312 base::TimeDelta::FromSeconds(1), | 312 base::TimeDelta::FromSeconds(1), |
313 this, | 313 this, |
314 &ResolutionNotificationController::OnTimerTick); | 314 &ResolutionNotificationController::OnTimerTick); |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 void ResolutionNotificationController::SuppressTimerForTest() { | 318 void ResolutionNotificationController::SuppressTimerForTest() { |
319 g_use_timer = false; | 319 g_use_timer = false; |
320 } | 320 } |
321 | 321 |
322 } // namespace ash | 322 } // namespace ash |
OLD | NEW |