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/common/system/tray/system_tray.cc

Issue 2784163003: Dismiss the system menu if the status area is clicked while the menu is open. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | 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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 TrayBubbleView* bubble_view = GetSystemBubble()->bubble_view(); 700 TrayBubbleView* bubble_view = GetSystemBubble()->bubble_view();
701 // If system tray bubble is in the process of closing, do not try to activate 701 // If system tray bubble is in the process of closing, do not try to activate
702 // bubble. 702 // bubble.
703 if (bubble_view->GetWidget()->IsClosed()) 703 if (bubble_view->GetWidget()->IsClosed())
704 return; 704 return;
705 bubble_view->set_can_activate(true); 705 bubble_view->set_can_activate(true);
706 bubble_view->GetWidget()->Activate(); 706 bubble_view->GetWidget()->Activate();
707 } 707 }
708 708
709 bool SystemTray::PerformAction(const ui::Event& event) { 709 bool SystemTray::PerformAction(const ui::Event& event) {
710 // If we're already showing the default view, hide it; otherwise, show it 710 // If we're already showing the menu (whatever default view or detailed view,
tdanderson 2017/03/30 19:54:57 nit: no need to mention the bug number in the comm
711 // (and hide any popup that's currently shown). 711 // crbug.com/690112), hide it; otherwise, show it (and hide any popup that's
712 if (HasSystemBubbleType(SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { 712 // currently shown).
713 if (system_bubble_.get()) {
tdanderson 2017/03/30 19:54:57 nit: call HasSystemBubble() here instead
713 system_bubble_->bubble()->Close(); 714 system_bubble_->bubble()->Close();
714 } else { 715 } else {
715 ShowDefaultView(BUBBLE_CREATE_NEW); 716 ShowDefaultView(BUBBLE_CREATE_NEW);
716 if (event.IsKeyEvent() || (event.flags() & ui::EF_TOUCH_ACCESSIBILITY)) 717 if (event.IsKeyEvent() || (event.flags() & ui::EF_TOUCH_ACCESSIBILITY))
717 ActivateBubble(); 718 ActivateBubble();
718 } 719 }
719 return true; 720 return true;
720 } 721 }
721 722
722 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() { 723 void SystemTray::CloseSystemBubbleAndDeactivateSystemTray() {
(...skipping 30 matching lines...) Expand all
753 .work_area() 754 .work_area()
754 .height(); 755 .height();
755 if (work_area_height > 0) { 756 if (work_area_height > 0) {
756 UMA_HISTOGRAM_CUSTOM_COUNTS( 757 UMA_HISTOGRAM_CUSTOM_COUNTS(
757 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu", 758 "Ash.SystemMenu.PercentageOfWorkAreaHeightCoveredByMenu",
758 100 * bubble_view->height() / work_area_height, 1, 300, 100); 759 100 * bubble_view->height() / work_area_height, 1, 300, 100);
759 } 760 }
760 } 761 }
761 762
762 } // namespace ash 763 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698