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 "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" |
11 #include "ash/system/tray/actionable_view.h" | 11 #include "ash/system/tray/actionable_view.h" |
12 #include "ash/system/tray/fixed_sized_image_view.h" | 12 #include "ash/system/tray/fixed_sized_image_view.h" |
13 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
14 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
15 #include "ash/system/tray/tray_constants.h" | 15 #include "ash/system/tray/tray_constants.h" |
16 #include "ash/system/tray/tray_notification_view.h" | 16 #include "ash/system/tray/tray_notification_view.h" |
| 17 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
17 #include "base/bind.h" | 18 #include "base/bind.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "grit/ash_resources.h" | 21 #include "grit/ash_resources.h" |
21 #include "grit/ash_strings.h" | 22 #include "grit/ash_strings.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/message_center/message_center.h" | 25 #include "ui/message_center/message_center.h" |
25 #include "ui/message_center/notification.h" | 26 #include "ui/message_center/notification.h" |
26 #include "ui/message_center/notification_delegate.h" | 27 #include "ui/message_center/notification_delegate.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 const base::string16& message, | 368 const base::string16& message, |
368 const base::string16& additional_message) { | 369 const base::string16& additional_message) { |
369 // Always remove the notification to make sure the notification appears | 370 // Always remove the notification to make sure the notification appears |
370 // as a popup in any situation. | 371 // as a popup in any situation. |
371 message_center::MessageCenter::Get()->RemoveNotification( | 372 message_center::MessageCenter::Get()->RemoveNotification( |
372 kNotificationId, false /* by_user */); | 373 kNotificationId, false /* by_user */); |
373 | 374 |
374 if (message.empty()) | 375 if (message.empty()) |
375 return; | 376 return; |
376 | 377 |
| 378 // Don't display notifications for accelerometer triggered screen rotations. |
| 379 // See http://crbug.com/364949 |
| 380 if (Shell::GetInstance()->maximize_mode_controller()-> |
| 381 in_set_screen_rotation()) { |
| 382 return; |
| 383 } |
| 384 |
377 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 385 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
378 scoped_ptr<Notification> notification(new Notification( | 386 scoped_ptr<Notification> notification(new Notification( |
379 message_center::NOTIFICATION_TYPE_SIMPLE, | 387 message_center::NOTIFICATION_TYPE_SIMPLE, |
380 kNotificationId, | 388 kNotificationId, |
381 message, | 389 message, |
382 additional_message, | 390 additional_message, |
383 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), | 391 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), |
384 base::string16(), // display_source | 392 base::string16(), // display_source |
385 message_center::NotifierId( | 393 message_center::NotifierId( |
386 message_center::NotifierId::SYSTEM_COMPONENT, | 394 message_center::NotifierId::SYSTEM_COMPONENT, |
387 system_notifier::kNotifierDisplay), | 395 system_notifier::kNotifierDisplay), |
388 message_center::RichNotificationData(), | 396 message_center::RichNotificationData(), |
389 new message_center::HandleNotificationClickedDelegate( | 397 new message_center::HandleNotificationClickedDelegate( |
390 base::Bind(&OpenSettings)))); | 398 base::Bind(&OpenSettings)))); |
391 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 399 |
| 400 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
392 } | 401 } |
393 | 402 |
394 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { | 403 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { |
395 DCHECK(default_ == NULL); | 404 DCHECK(default_ == NULL); |
396 default_ = new DisplayView(); | 405 default_ = new DisplayView(); |
397 return default_; | 406 return default_; |
398 } | 407 } |
399 | 408 |
400 void TrayDisplay::DestroyDefaultView() { | 409 void TrayDisplay::DestroyDefaultView() { |
401 default_ = NULL; | 410 default_ = NULL; |
(...skipping 27 matching lines...) Expand all Loading... |
429 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { | 438 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { |
430 views::View* view = default_; | 439 views::View* view = default_; |
431 if (view) { | 440 if (view) { |
432 view->GetAccessibleState(state); | 441 view->GetAccessibleState(state); |
433 return true; | 442 return true; |
434 } | 443 } |
435 return false; | 444 return false; |
436 } | 445 } |
437 | 446 |
438 } // namespace ash | 447 } // namespace ash |
OLD | NEW |