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

Side by Side Diff: ash/common/system/tray/system_tray.cc

Issue 2392183002: Add check to identify the cause of the crash. (Closed)
Patch Set: Add check to identify the cause of the crash. Created 4 years, 2 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
« no previous file with comments | « ash/common/system/tray/system_tray.h ('k') | no next file » | 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/common/system/tray/system_tray.h" 5 #include "ash/common/system/tray/system_tray.h"
6 6
7 #include "ash/common/key_event_watcher.h" 7 #include "ash/common/key_event_watcher.h"
8 #include "ash/common/login_status.h" 8 #include "ash/common/login_status.h"
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 bool SystemTray::IsMouseInNotificationBubble() const { 412 bool SystemTray::IsMouseInNotificationBubble() const {
413 if (!notification_bubble_) 413 if (!notification_bubble_)
414 return false; 414 return false;
415 return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains( 415 return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains(
416 display::Screen::GetScreen()->GetCursorScreenPoint()); 416 display::Screen::GetScreen()->GetCursorScreenPoint());
417 } 417 }
418 418
419 bool SystemTray::CloseSystemBubble() const { 419 bool SystemTray::CloseSystemBubble() const {
420 if (!system_bubble_) 420 if (!system_bubble_)
421 return false; 421 return false;
422 CHECK(!activating_);
422 system_bubble_->bubble()->Close(); 423 system_bubble_->bubble()->Close();
423 return true; 424 return true;
424 } 425 }
425 426
426 views::View* SystemTray::GetHelpButtonView() const { 427 views::View* SystemTray::GetHelpButtonView() const {
427 return tray_date_->GetHelpButtonView(); 428 return tray_date_->GetHelpButtonView();
428 } 429 }
429 430
430 TrayAudio* SystemTray::GetTrayAudio() const { 431 TrayAudio* SystemTray::GetTrayAudio() const {
431 return tray_audio_; 432 return tray_audio_;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 return tray_update_; 787 return tray_update_;
787 } 788 }
788 789
789 void SystemTray::CloseBubble(const ui::KeyEvent& key_event) { 790 void SystemTray::CloseBubble(const ui::KeyEvent& key_event) {
790 CloseSystemBubble(); 791 CloseSystemBubble();
791 } 792 }
792 793
793 void SystemTray::ActivateAndStartNavigation(const ui::KeyEvent& key_event) { 794 void SystemTray::ActivateAndStartNavigation(const ui::KeyEvent& key_event) {
794 if (!system_bubble_) 795 if (!system_bubble_)
795 return; 796 return;
797 activating_ = true;
796 ActivateBubble(); 798 ActivateBubble();
799 activating_ = false;
800 // TODO(oshima): This is to troubleshoot the issue crbug.com/651242. Remove
801 // once the root cause is fixed.
802 CHECK(system_bubble_) << " the bubble was deleted while activaing it";
803
797 views::Widget* widget = GetSystemBubble()->bubble_view()->GetWidget(); 804 views::Widget* widget = GetSystemBubble()->bubble_view()->GetWidget();
798 widget->GetFocusManager()->OnKeyEvent(key_event); 805 widget->GetFocusManager()->OnKeyEvent(key_event);
799 } 806 }
800 807
801 void SystemTray::CreateKeyEventWatcher() { 808 void SystemTray::CreateKeyEventWatcher() {
802 key_event_watcher_ = WmShell::Get()->CreateKeyEventWatcher(); 809 key_event_watcher_ = WmShell::Get()->CreateKeyEventWatcher();
803 // mustash does not yet support KeyEventWatcher. http://crbug.com/649600. 810 // mustash does not yet support KeyEventWatcher. http://crbug.com/649600.
804 if (!key_event_watcher_) 811 if (!key_event_watcher_)
805 return; 812 return;
806 key_event_watcher_->AddKeyEventCallback( 813 key_event_watcher_->AddKeyEventCallback(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 } 846 }
840 } 847 }
841 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset, false); 848 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset, false);
842 if (event.IsKeyEvent()) 849 if (event.IsKeyEvent())
843 ActivateBubble(); 850 ActivateBubble();
844 } 851 }
845 return true; 852 return true;
846 } 853 }
847 854
848 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { 855 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() {
856 CHECK(!activating_);
849 activation_observer_.reset(); 857 activation_observer_.reset();
850 key_event_watcher_.reset(); 858 key_event_watcher_.reset();
851 system_bubble_.reset(); 859 system_bubble_.reset();
852 // When closing a system bubble with the alternate shelf layout, we need to 860 // When closing a system bubble with the alternate shelf layout, we need to
853 // turn off the active tinting of the shelf. 861 // turn off the active tinting of the shelf.
854 if (full_system_tray_menu_) { 862 if (full_system_tray_menu_) {
855 SetDrawBackgroundAsActive(false); 863 SetDrawBackgroundAsActive(false);
856 full_system_tray_menu_ = false; 864 full_system_tray_menu_ = false;
857 } 865 }
858 } 866 }
(...skipping 19 matching lines...) Expand all
878 .work_area() 886 .work_area()
879 .height(); 887 .height();
880 if (work_area_height > 0) { 888 if (work_area_height > 0) {
881 UMA_HISTOGRAM_CUSTOM_COUNTS( 889 UMA_HISTOGRAM_CUSTOM_COUNTS(
882 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", 890 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu",
883 100 * bubble_view->height() / work_area_height, 1, 300, 100); 891 100 * bubble_view->height() / work_area_height, 1, 300, 100);
884 } 892 }
885 } 893 }
886 894
887 } // namespace ash 895 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698