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

Unified Diff: ash/system/screen_layout_observer.cc

Issue 2866423002: Don't show rotation change notification in tablet mode unless it's changed by user. (Closed)
Patch Set: Don't show rotation change notification in tablet mode unless it's changed by user. Created 3 years, 7 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/system/screen_layout_observer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/screen_layout_observer.cc
diff --git a/ash/system/screen_layout_observer.cc b/ash/system/screen_layout_observer.cc
index 0056693d5a9f7f7988d3c985e5e548ea39ae2c03..1614ca8238ab8c87373e64395b73bf85cd622fdd 100644
--- a/ash/system/screen_layout_observer.cc
+++ b/ash/system/screen_layout_observer.cc
@@ -20,6 +20,7 @@
#include "ash/system/tray/fixed_sized_image_view.h"
#include "ash/system/tray/system_tray_controller.h"
#include "ash/system/tray/tray_constants.h"
+#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "base/bind.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -271,32 +272,43 @@ bool ScreenLayoutObserver::GetDisplayMessageForNotification(
GetDisplayName(iter.first), GetDisplaySize(iter.first));
return true;
}
- // We don't show rotation change notification when the rotation source is
- // the accelerometer.
- if (iter.second.active_rotation_source() !=
- display::Display::ROTATION_SOURCE_ACCELEROMETER &&
- iter.second.GetActiveRotation() !=
- old_iter->second.GetActiveRotation()) {
- int rotation_text_id = 0;
- switch (iter.second.GetActiveRotation()) {
- case display::Display::ROTATE_0:
- rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION;
- break;
- case display::Display::ROTATE_90:
- rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90;
- break;
- case display::Display::ROTATE_180:
- rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180;
- break;
- case display::Display::ROTATE_270:
- rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270;
- break;
- }
- *out_additional_message = l10n_util::GetStringFUTF16(
- IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetDisplayName(iter.first),
- l10n_util::GetStringUTF16(rotation_text_id));
- return true;
+ // Don't show rotation change notification if
+ // a) no rotation change
+ if (iter.second.GetActiveRotation() == old_iter->second.GetActiveRotation())
+ continue;
+ // b) the source is accelerometer.
+ if (iter.second.active_rotation_source() ==
+ display::Display::ROTATION_SOURCE_ACCELEROMETER) {
+ continue;
+ }
+ // c) if the device is in tablet mode, and source is not user.
+ if (Shell::Get()
+ ->maximize_mode_controller()
+ ->IsMaximizeModeWindowManagerEnabled() &&
+ iter.second.active_rotation_source() !=
+ display::Display::ROTATION_SOURCE_USER) {
+ continue;
+ }
+
+ int rotation_text_id = 0;
+ switch (iter.second.GetActiveRotation()) {
+ case display::Display::ROTATE_0:
+ rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION;
+ break;
+ case display::Display::ROTATE_90:
+ rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90;
+ break;
+ case display::Display::ROTATE_180:
+ rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180;
+ break;
+ case display::Display::ROTATE_270:
+ rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270;
+ break;
}
+ *out_additional_message = l10n_util::GetStringFUTF16(
+ IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetDisplayName(iter.first),
+ l10n_util::GetStringUTF16(rotation_text_id));
+ return true;
}
// Found nothing special
« no previous file with comments | « no previous file | ash/system/screen_layout_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698