Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system/screen_layout_observer.h" | 5 #include "ash/system/screen_layout_observer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/display/screen_orientation_controller_chromeos.h" | 11 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 12 #include "ash/metrics/user_metrics_action.h" | 12 #include "ash/metrics/user_metrics_action.h" |
| 13 #include "ash/resources/grit/ash_resources.h" | 13 #include "ash/resources/grit/ash_resources.h" |
| 14 #include "ash/session/session_controller.h" | 14 #include "ash/session/session_controller.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/shell_port.h" | 16 #include "ash/shell_port.h" |
| 17 #include "ash/strings/grit/ash_strings.h" | 17 #include "ash/strings/grit/ash_strings.h" |
| 18 #include "ash/system/devicetype_utils.h" | 18 #include "ash/system/devicetype_utils.h" |
| 19 #include "ash/system/system_notifier.h" | 19 #include "ash/system/system_notifier.h" |
| 20 #include "ash/system/tray/fixed_sized_image_view.h" | 20 #include "ash/system/tray/fixed_sized_image_view.h" |
| 21 #include "ash/system/tray/system_tray_controller.h" | 21 #include "ash/system/tray/system_tray_controller.h" |
| 22 #include "ash/system/tray/tray_constants.h" | 22 #include "ash/system/tray/tray_constants.h" |
| 23 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 23 #include "base/bind.h" | 24 #include "base/bind.h" |
| 24 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/display/display.h" | 29 #include "ui/display/display.h" |
| 29 #include "ui/display/manager/display_manager.h" | 30 #include "ui/display/manager/display_manager.h" |
| 30 #include "ui/display/types/display_constants.h" | 31 #include "ui/display/types/display_constants.h" |
| 31 #include "ui/message_center/message_center.h" | 32 #include "ui/message_center/message_center.h" |
| 32 #include "ui/message_center/notification.h" | 33 #include "ui/message_center/notification.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 return false; | 265 return false; |
| 265 } | 266 } |
| 266 | 267 |
| 267 if (iter.second.configured_ui_scale() != | 268 if (iter.second.configured_ui_scale() != |
| 268 old_iter->second.configured_ui_scale()) { | 269 old_iter->second.configured_ui_scale()) { |
| 269 *out_additional_message = l10n_util::GetStringFUTF16( | 270 *out_additional_message = l10n_util::GetStringFUTF16( |
| 270 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, | 271 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, |
| 271 GetDisplayName(iter.first), GetDisplaySize(iter.first)); | 272 GetDisplayName(iter.first), GetDisplaySize(iter.first)); |
| 272 return true; | 273 return true; |
| 273 } | 274 } |
| 274 // We don't show rotation change notification when the rotation source is | 275 if (iter.second.GetActiveRotation() == old_iter->second.GetActiveRotation()) |
| 275 // the accelerometer. | 276 continue; |
| 276 if (iter.second.active_rotation_source() != | 277 |
| 277 display::Display::ROTATION_SOURCE_ACCELEROMETER && | 278 // We don't show rotation change notification if |
| 278 iter.second.GetActiveRotation() != | 279 // a) the source is accelerometer. |
| 279 old_iter->second.GetActiveRotation()) { | 280 // b) if the device is in tablet mode, and source is not user. |
|
Mr4D (OOO till 08-26)
2017/05/10 04:37:48
You might want to move this comment to line 275 an
oshima
2017/05/10 04:59:23
Done
| |
| 280 int rotation_text_id = 0; | 281 if (iter.second.active_rotation_source() == |
| 281 switch (iter.second.GetActiveRotation()) { | 282 display::Display::ROTATION_SOURCE_ACCELEROMETER) { |
| 282 case display::Display::ROTATE_0: | 283 continue; |
| 283 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; | |
| 284 break; | |
| 285 case display::Display::ROTATE_90: | |
| 286 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; | |
| 287 break; | |
| 288 case display::Display::ROTATE_180: | |
| 289 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; | |
| 290 break; | |
| 291 case display::Display::ROTATE_270: | |
| 292 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270; | |
| 293 break; | |
| 294 } | |
| 295 *out_additional_message = l10n_util::GetStringFUTF16( | |
| 296 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetDisplayName(iter.first), | |
| 297 l10n_util::GetStringUTF16(rotation_text_id)); | |
| 298 return true; | |
| 299 } | 284 } |
| 285 if (Shell::Get() | |
| 286 ->maximize_mode_controller() | |
| 287 ->IsMaximizeModeWindowManagerEnabled() && | |
| 288 iter.second.active_rotation_source() != | |
| 289 display::Display::ROTATION_SOURCE_USER) { | |
| 290 continue; | |
| 291 } | |
| 292 | |
| 293 int rotation_text_id = 0; | |
| 294 switch (iter.second.GetActiveRotation()) { | |
| 295 case display::Display::ROTATE_0: | |
| 296 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; | |
| 297 break; | |
| 298 case display::Display::ROTATE_90: | |
| 299 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; | |
| 300 break; | |
| 301 case display::Display::ROTATE_180: | |
| 302 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; | |
| 303 break; | |
| 304 case display::Display::ROTATE_270: | |
| 305 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270; | |
| 306 break; | |
| 307 } | |
| 308 *out_additional_message = l10n_util::GetStringFUTF16( | |
| 309 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetDisplayName(iter.first), | |
| 310 l10n_util::GetStringUTF16(rotation_text_id)); | |
| 311 return true; | |
| 300 } | 312 } |
| 301 | 313 |
| 302 // Found nothing special | 314 // Found nothing special |
| 303 return false; | 315 return false; |
| 304 } | 316 } |
| 305 | 317 |
| 306 void ScreenLayoutObserver::CreateOrUpdateNotification( | 318 void ScreenLayoutObserver::CreateOrUpdateNotification( |
| 307 const base::string16& message, | 319 const base::string16& message, |
| 308 const base::string16& additional_message) { | 320 const base::string16& additional_message) { |
| 309 // Always remove the notification to make sure the notification appears | 321 // Always remove the notification to make sure the notification appears |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 return true; | 406 return true; |
| 395 | 407 |
| 396 default: | 408 default: |
| 397 // Mirror mode was turned off; other messages should be shown e.g. | 409 // Mirror mode was turned off; other messages should be shown e.g. |
| 398 // extended mode is on, ... etc. | 410 // extended mode is on, ... etc. |
| 399 return false; | 411 return false; |
| 400 } | 412 } |
| 401 } | 413 } |
| 402 | 414 |
| 403 } // namespace ash | 415 } // namespace ash |
| OLD | NEW |