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

Side by Side Diff: trunk/src/ash/system/chromeos/tray_display.cc

Issue 290563003: Revert 270746 "Suppressed screen rotation notifications triggere..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/ash/wm/maximize_mode/maximize_mode_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
18 #include "base/bind.h" 17 #include "base/bind.h"
19 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
21 #include "grit/ash_resources.h" 20 #include "grit/ash_resources.h"
22 #include "grit/ash_strings.h" 21 #include "grit/ash_strings.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
25 #include "ui/message_center/message_center.h" 24 #include "ui/message_center/message_center.h"
26 #include "ui/message_center/notification.h" 25 #include "ui/message_center/notification.h"
27 #include "ui/message_center/notification_delegate.h" 26 #include "ui/message_center/notification_delegate.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 const base::string16& message, 367 const base::string16& message,
369 const base::string16& additional_message) { 368 const base::string16& additional_message) {
370 // Always remove the notification to make sure the notification appears 369 // Always remove the notification to make sure the notification appears
371 // as a popup in any situation. 370 // as a popup in any situation.
372 message_center::MessageCenter::Get()->RemoveNotification( 371 message_center::MessageCenter::Get()->RemoveNotification(
373 kNotificationId, false /* by_user */); 372 kNotificationId, false /* by_user */);
374 373
375 if (message.empty()) 374 if (message.empty())
376 return; 375 return;
377 376
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
385 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 377 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
386 scoped_ptr<Notification> notification(new Notification( 378 scoped_ptr<Notification> notification(new Notification(
387 message_center::NOTIFICATION_TYPE_SIMPLE, 379 message_center::NOTIFICATION_TYPE_SIMPLE,
388 kNotificationId, 380 kNotificationId,
389 message, 381 message,
390 additional_message, 382 additional_message,
391 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), 383 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY),
392 base::string16(), // display_source 384 base::string16(), // display_source
393 message_center::NotifierId( 385 message_center::NotifierId(
394 message_center::NotifierId::SYSTEM_COMPONENT, 386 message_center::NotifierId::SYSTEM_COMPONENT,
395 system_notifier::kNotifierDisplay), 387 system_notifier::kNotifierDisplay),
396 message_center::RichNotificationData(), 388 message_center::RichNotificationData(),
397 new message_center::HandleNotificationClickedDelegate( 389 new message_center::HandleNotificationClickedDelegate(
398 base::Bind(&OpenSettings)))); 390 base::Bind(&OpenSettings))));
399 391 message_center::MessageCenter::Get()->AddNotification(notification.Pass());
400 message_center::MessageCenter::Get()->AddNotification(notification.Pass());
401 } 392 }
402 393
403 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { 394 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
404 DCHECK(default_ == NULL); 395 DCHECK(default_ == NULL);
405 default_ = new DisplayView(); 396 default_ = new DisplayView();
406 return default_; 397 return default_;
407 } 398 }
408 399
409 void TrayDisplay::DestroyDefaultView() { 400 void TrayDisplay::DestroyDefaultView() {
410 default_ = NULL; 401 default_ = NULL;
(...skipping 27 matching lines...) Expand all
438 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { 429 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) {
439 views::View* view = default_; 430 views::View* view = default_;
440 if (view) { 431 if (view) {
441 view->GetAccessibleState(state); 432 view->GetAccessibleState(state);
442 return true; 433 return true;
443 } 434 }
444 return false; 435 return false;
445 } 436 }
446 437
447 } // namespace ash 438 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | trunk/src/ash/wm/maximize_mode/maximize_mode_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698