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

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

Issue 267743010: Suppressed screen rotation notifications triggeres by the accelerometer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated to not add display notifications when screen rotations are being changed by the MaximizeMod… 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
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"
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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 message, 382 message,
382 additional_message, 383 additional_message,
383 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), 384 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY),
384 base::string16(), // display_source 385 base::string16(), // display_source
385 message_center::NotifierId( 386 message_center::NotifierId(
386 message_center::NotifierId::SYSTEM_COMPONENT, 387 message_center::NotifierId::SYSTEM_COMPONENT,
387 system_notifier::kNotifierDisplay), 388 system_notifier::kNotifierDisplay),
388 message_center::RichNotificationData(), 389 message_center::RichNotificationData(),
389 new message_center::HandleNotificationClickedDelegate( 390 new message_center::HandleNotificationClickedDelegate(
390 base::Bind(&OpenSettings)))); 391 base::Bind(&OpenSettings))));
391 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); 392
393 message_center::MessageCenter* message_center =
394 message_center::MessageCenter::Get();
395 MaximizeModeController* maximize_mode_controller =
396 Shell::GetInstance()->maximize_mode_controller();
397 // Display notifications caused from physically rotating the device
398 // would be annoying and not useful to the user.
flackr 2014/05/14 20:12:41 Probably simply state that we don't display notifi
bruthig 2014/05/14 21:07:35 Done.
399 if (maximize_mode_controller &&
flackr 2014/05/14 20:12:41 Are there cases where this is called and MaximizeM
bruthig 2014/05/14 21:07:35 Done.
400 !maximize_mode_controller->in_set_screen_rotation()) {
401 message_center->AddNotification(notification.Pass());
402 }
flackr 2014/05/14 20:12:41 else dismiss an active notification if it exists?
bruthig 2014/05/14 21:07:35 Previous notifications are already dismissed above
392 } 403 }
393 404
394 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) { 405 views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
395 DCHECK(default_ == NULL); 406 DCHECK(default_ == NULL);
396 default_ = new DisplayView(); 407 default_ = new DisplayView();
397 return default_; 408 return default_;
398 } 409 }
399 410
400 void TrayDisplay::DestroyDefaultView() { 411 void TrayDisplay::DestroyDefaultView() {
401 default_ = NULL; 412 default_ = NULL;
(...skipping 27 matching lines...) Expand all
429 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) { 440 bool TrayDisplay::GetAccessibleStateForTesting(ui::AXViewState* state) {
430 views::View* view = default_; 441 views::View* view = default_;
431 if (view) { 442 if (view) {
432 view->GetAccessibleState(state); 443 view->GetAccessibleState(state);
433 return true; 444 return true;
434 } 445 }
435 return false; 446 return false;
436 } 447 }
437 448
438 } // namespace ash 449 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/maximize_mode/maximize_mode_controller.h » ('j') | ash/wm/maximize_mode/maximize_mode_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698