| 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/chromeos/tray_display.h" | 5 #include "ash/system/chromeos/tray_display.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/content/display/screen_orientation_controller_chromeos.h" | 9 #include "ash/content/display/screen_orientation_controller_chromeos.h" |
| 10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // The display's number is same but different displays. This happens | 327 // The display's number is same but different displays. This happens |
| 328 // for the transition between docked mode and mirrored display. Falls back | 328 // for the transition between docked mode and mirrored display. Falls back |
| 329 // to GetTrayDisplayMessage(). | 329 // to GetTrayDisplayMessage(). |
| 330 if (old_iter == old_info.end()) { | 330 if (old_iter == old_info.end()) { |
| 331 *message_out = DisplayView::GetTrayDisplayMessage(additional_message_out); | 331 *message_out = DisplayView::GetTrayDisplayMessage(additional_message_out); |
| 332 return true; | 332 return true; |
| 333 } | 333 } |
| 334 | 334 |
| 335 if (iter->second.configured_ui_scale() != | 335 if (iter->second.configured_ui_scale() != |
| 336 old_iter->second.configured_ui_scale()) { | 336 old_iter->second.configured_ui_scale()) { |
| 337 *message_out = l10n_util::GetStringFUTF16( | 337 *additional_message_out = l10n_util::GetStringFUTF16( |
| 338 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, | 338 IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, |
| 339 GetDisplayName(iter->first), | 339 GetDisplayName(iter->first), GetDisplaySize(iter->first)); |
| 340 GetDisplaySize(iter->first)); | |
| 341 return true; | 340 return true; |
| 342 } | 341 } |
| 343 if (iter->second.rotation() != old_iter->second.rotation()) { | 342 if (iter->second.rotation() != old_iter->second.rotation()) { |
| 344 int rotation_text_id = 0; | 343 int rotation_text_id = 0; |
| 345 switch (iter->second.rotation()) { | 344 switch (iter->second.rotation()) { |
| 346 case gfx::Display::ROTATE_0: | 345 case gfx::Display::ROTATE_0: |
| 347 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; | 346 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_STANDARD_ORIENTATION; |
| 348 break; | 347 break; |
| 349 case gfx::Display::ROTATE_90: | 348 case gfx::Display::ROTATE_90: |
| 350 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; | 349 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_90; |
| 351 break; | 350 break; |
| 352 case gfx::Display::ROTATE_180: | 351 case gfx::Display::ROTATE_180: |
| 353 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; | 352 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_180; |
| 354 break; | 353 break; |
| 355 case gfx::Display::ROTATE_270: | 354 case gfx::Display::ROTATE_270: |
| 356 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270; | 355 rotation_text_id = IDS_ASH_STATUS_TRAY_DISPLAY_ORIENTATION_270; |
| 357 break; | 356 break; |
| 358 } | 357 } |
| 359 *message_out = l10n_util::GetStringFUTF16( | 358 *additional_message_out = l10n_util::GetStringFUTF16( |
| 360 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, | 359 IDS_ASH_STATUS_TRAY_DISPLAY_ROTATED, GetDisplayName(iter->first), |
| 361 GetDisplayName(iter->first), | |
| 362 l10n_util::GetStringUTF16(rotation_text_id)); | 360 l10n_util::GetStringUTF16(rotation_text_id)); |
| 363 return true; | 361 return true; |
| 364 } | 362 } |
| 365 } | 363 } |
| 366 | 364 |
| 367 // Found nothing special | 365 // Found nothing special |
| 368 return false; | 366 return false; |
| 369 } | 367 } |
| 370 | 368 |
| 371 void TrayDisplay::CreateOrUpdateNotification( | 369 void TrayDisplay::CreateOrUpdateNotification( |
| 372 const base::string16& message, | 370 const base::string16& message, |
| 373 const base::string16& additional_message) { | 371 const base::string16& additional_message) { |
| 374 // Always remove the notification to make sure the notification appears | 372 // Always remove the notification to make sure the notification appears |
| 375 // as a popup in any situation. | 373 // as a popup in any situation. |
| 376 message_center::MessageCenter::Get()->RemoveNotification( | 374 message_center::MessageCenter::Get()->RemoveNotification( |
| 377 kNotificationId, false /* by_user */); | 375 kNotificationId, false /* by_user */); |
| 378 | 376 |
| 379 if (message.empty()) | 377 if (message.empty() && additional_message.empty()) |
| 380 return; | 378 return; |
| 381 | 379 |
| 382 // Don't display notifications for accelerometer triggered screen rotations. | 380 // Don't display notifications for accelerometer triggered screen rotations. |
| 383 // See http://crbug.com/364949 | 381 // See http://crbug.com/364949 |
| 384 if (Shell::GetInstance() | 382 if (Shell::GetInstance() |
| 385 ->screen_orientation_controller() | 383 ->screen_orientation_controller() |
| 386 ->ignore_display_configuration_updates()) { | 384 ->ignore_display_configuration_updates()) { |
| 387 return; | 385 return; |
| 388 } | 386 } |
| 389 | 387 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 441 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
| 444 views::View* view = default_; | 442 views::View* view = default_; |
| 445 if (view) { | 443 if (view) { |
| 446 view->GetAccessibleState(state); | 444 view->GetAccessibleState(state); |
| 447 return true; | 445 return true; |
| 448 } | 446 } |
| 449 return false; | 447 return false; |
| 450 } | 448 } |
| 451 | 449 |
| 452 } // namespace ash | 450 } // namespace ash |
| OLD | NEW |