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

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

Issue 1887263002: Revert of mash: Close system tray bubble on click outside its bounds, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | ui/views/bubble/tray_bubble_view.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/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/metrics/user_metrics_recorder.h" 8 #include "ash/metrics/user_metrics_recorder.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 full_system_tray_menu_ = items.size() > 1; 493 full_system_tray_menu_ = items.size() > 1;
494 // The menu width is fixed, and it is a per language setting. 494 // The menu width is fixed, and it is a per language setting.
495 int menu_width = std::max(kMinimumSystemTrayMenuWidth, 495 int menu_width = std::max(kMinimumSystemTrayMenuWidth,
496 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); 496 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth());
497 497
498 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, 498 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY,
499 GetAnchorAlignment(), 499 GetAnchorAlignment(),
500 menu_width, 500 menu_width,
501 kTrayPopupMaxWidth); 501 kTrayPopupMaxWidth);
502 init_params.can_activate = can_activate; 502 init_params.can_activate = can_activate;
503 // Mus cannot use EventHandlers to close the tray, so it uses capture.
504 init_params.close_via_capture = Shell::GetInstance()->in_mus();
505 init_params.first_item_has_no_margin = true; 503 init_params.first_item_has_no_margin = true;
506 if (detailed) { 504 if (detailed) {
507 // This is the case where a volume control or brightness control bubble 505 // This is the case where a volume control or brightness control bubble
508 // is created. 506 // is created.
509 init_params.max_height = default_bubble_height_; 507 init_params.max_height = default_bubble_height_;
510 init_params.arrow_color = kBackgroundColor; 508 init_params.arrow_color = kBackgroundColor;
511 } else { 509 } else {
512 init_params.arrow_color = kHeaderBackgroundColor; 510 init_params.arrow_color = kHeaderBackgroundColor;
513 } 511 }
514 init_params.arrow_offset = arrow_offset; 512 init_params.arrow_offset = arrow_offset;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 anchor = system_bubble_->bubble_view(); 565 anchor = system_bubble_->bubble_view();
568 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; 566 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE;
569 } else { 567 } else {
570 anchor = tray_container(); 568 anchor = tray_container();
571 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; 569 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY;
572 } 570 }
573 TrayBubbleView::InitParams init_params(anchor_type, 571 TrayBubbleView::InitParams init_params(anchor_type,
574 GetAnchorAlignment(), 572 GetAnchorAlignment(),
575 kTrayPopupMinWidth, 573 kTrayPopupMinWidth,
576 kTrayPopupMaxWidth); 574 kTrayPopupMaxWidth);
577 // Mus cannot use EventHandlers to close the tray, so it uses capture.
578 init_params.close_via_capture = Shell::GetInstance()->in_mus();
579 init_params.first_item_has_no_margin = true; 575 init_params.first_item_has_no_margin = true;
580 init_params.arrow_color = kBackgroundColor; 576 init_params.arrow_color = kBackgroundColor;
581 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); 577 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]);
582 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble)); 578 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble));
583 notification_bubble_->InitView(this, anchor, &init_params, false); 579 notification_bubble_->InitView(this, anchor, &init_params, false);
584 580
585 if (notification_bubble->bubble_view()->child_count() == 0) { 581 if (notification_bubble->bubble_view()->child_count() == 0) {
586 // It is possible that none of the items generated actual notifications. 582 // It is possible that none of the items generated actual notifications.
587 DestroyNotificationBubble(); 583 DestroyNotificationBubble();
588 return; 584 return;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 system_bubble_.reset(); 732 system_bubble_.reset();
737 // When closing a system bubble with the alternate shelf layout, we need to 733 // When closing a system bubble with the alternate shelf layout, we need to
738 // turn off the active tinting of the shelf. 734 // turn off the active tinting of the shelf.
739 if (full_system_tray_menu_) { 735 if (full_system_tray_menu_) {
740 SetDrawBackgroundAsActive(false); 736 SetDrawBackgroundAsActive(false);
741 full_system_tray_menu_ = false; 737 full_system_tray_menu_ = false;
742 } 738 }
743 } 739 }
744 740
745 } // namespace ash 741 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/tray_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698