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

Unified Diff: ash/accelerators/accelerator_commands_aura.cc

Issue 2196923002: Make ash::DisplayMode more like ui::DisplayMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/common/display/display_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_commands_aura.cc
diff --git a/ash/accelerators/accelerator_commands_aura.cc b/ash/accelerators/accelerator_commands_aura.cc
index 0c5bb9857b5a9f8a8d81cd0c8ecf5d2f1568d1a5..758f1a02bf0a1c02062b63641cadb0962bfee0d7 100644
--- a/ash/accelerators/accelerator_commands_aura.cc
+++ b/ash/accelerators/accelerator_commands_aura.cc
@@ -4,6 +4,7 @@
#include "ash/accelerators/accelerator_commands_aura.h"
+#include "ash/common/display/display_info.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm_window.h"
#include "ash/display/display_manager.h"
@@ -39,15 +40,15 @@ bool ZoomInternalDisplay(bool up) {
? DisplayManager::kUnifiedDisplayId
: display_manager->GetDisplayIdForUIScaling();
const DisplayInfo& display_info = display_manager->GetDisplayInfo(display_id);
- DisplayMode mode;
- if (display_manager->IsInUnifiedMode()) {
- if (!GetDisplayModeForNextResolution(display_info, up, &mode))
- return false;
- } else {
- if (!GetDisplayModeForNextUIScale(display_info, up, &mode))
- return false;
- }
+ scoped_refptr<DisplayMode> mode;
+ if (display_manager->IsInUnifiedMode())
+ mode = GetDisplayModeForNextResolution(display_info, up);
+ else
+ mode = GetDisplayModeForNextUIScale(display_info, up);
+
+ if (!mode)
+ return false;
oshima 2016/08/04 17:54:00 optional nit: return mode ? .. : false;
return display_manager->SetDisplayMode(display_id, mode);
}
@@ -58,10 +59,10 @@ void ResetInternalDisplayZoom() {
if (display_manager->IsInUnifiedMode()) {
const DisplayInfo& display_info =
display_manager->GetDisplayInfo(DisplayManager::kUnifiedDisplayId);
- const std::vector<DisplayMode>& modes = display_info.display_modes();
- auto iter =
- std::find_if(modes.begin(), modes.end(),
- [](const DisplayMode& mode) { return mode.native; });
+ const DisplayInfo::DisplayModeList& modes = display_info.display_modes();
+ auto iter = std::find_if(
+ modes.begin(), modes.end(),
+ [](const scoped_refptr<DisplayMode>& mode) { return mode->native(); });
display_manager->SetDisplayMode(DisplayManager::kUnifiedDisplayId, *iter);
} else {
SetDisplayUIScale(display_manager->GetDisplayIdForUIScaling(), 1.0f);
« no previous file with comments | « no previous file | ash/common/display/display_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698