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

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

Issue 140323010: Ash:Shelf - Cleanup of Alternate Shelf (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void InitView(TrayBackgroundView* tray, 87 void InitView(TrayBackgroundView* tray,
88 views::View* anchor, 88 views::View* anchor,
89 TrayBubbleView::InitParams* init_params, 89 TrayBubbleView::InitParams* init_params,
90 bool is_persistent) { 90 bool is_persistent) {
91 DCHECK(anchor); 91 DCHECK(anchor);
92 user::LoginStatus login_status = 92 user::LoginStatus login_status =
93 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); 93 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus();
94 bubble_->InitView(anchor, login_status, init_params); 94 bubble_->InitView(anchor, login_status, init_params);
95 bubble_wrapper_.reset( 95 bubble_wrapper_.reset(
96 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view())); 96 new internal::TrayBubbleWrapper(tray, bubble_->bubble_view()));
97 if (ash::switches::UseAlternateShelfLayout()) { 97 // The system bubble should not have an arrow.
98 // The system bubble should not have an arrow. 98 bubble_->bubble_view()->SetArrowPaintType(
99 bubble_->bubble_view()->SetArrowPaintType( 99 views::BubbleBorder::PAINT_NONE);
100 views::BubbleBorder::PAINT_NONE);
101 }
102 is_persistent_ = is_persistent; 100 is_persistent_ = is_persistent;
103 101
104 // If ChromeVox is enabled, focus the default item if no item is focused. 102 // If ChromeVox is enabled, focus the default item if no item is focused.
105 if (Shell::GetInstance()->accessibility_delegate()-> 103 if (Shell::GetInstance()->accessibility_delegate()->
106 IsSpokenFeedbackEnabled()) { 104 IsSpokenFeedbackEnabled()) {
107 bubble_->FocusDefaultIfNeeded(); 105 bubble_->FocusDefaultIfNeeded();
108 } 106 }
109 } 107 }
110 108
111 // Convenience accessors: 109 // Convenience accessors:
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 full_system_tray_menu_ = items.size() > 1; 479 full_system_tray_menu_ = items.size() > 1;
482 // The menu width is fixed, and it is a per language setting. 480 // The menu width is fixed, and it is a per language setting.
483 int menu_width = std::max(kMinimumSystemTrayMenuWidth, 481 int menu_width = std::max(kMinimumSystemTrayMenuWidth,
484 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); 482 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth());
485 483
486 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, 484 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY,
487 GetAnchorAlignment(), 485 GetAnchorAlignment(),
488 menu_width, 486 menu_width,
489 kTrayPopupMaxWidth); 487 kTrayPopupMaxWidth);
490 init_params.can_activate = can_activate; 488 init_params.can_activate = can_activate;
491 init_params.first_item_has_no_margin = 489 init_params.first_item_has_no_margin = true;
492 ash::switches::UseAlternateShelfLayout();
493 if (detailed) { 490 if (detailed) {
494 // This is the case where a volume control or brightness control bubble 491 // This is the case where a volume control or brightness control bubble
495 // is created. 492 // is created.
496 init_params.max_height = default_bubble_height_; 493 init_params.max_height = default_bubble_height_;
497 init_params.arrow_color = kBackgroundColor; 494 init_params.arrow_color = kBackgroundColor;
498 } else { 495 } else {
499 init_params.arrow_color = kHeaderBackgroundColor; 496 init_params.arrow_color = kHeaderBackgroundColor;
500 } 497 }
501 init_params.arrow_offset = arrow_offset; 498 init_params.arrow_offset = arrow_offset;
502 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) 499 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 anchor = system_bubble_->bubble_view(); 550 anchor = system_bubble_->bubble_view();
554 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; 551 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE;
555 } else { 552 } else {
556 anchor = tray_container(); 553 anchor = tray_container();
557 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; 554 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY;
558 } 555 }
559 TrayBubbleView::InitParams init_params(anchor_type, 556 TrayBubbleView::InitParams init_params(anchor_type,
560 GetAnchorAlignment(), 557 GetAnchorAlignment(),
561 kTrayPopupMinWidth, 558 kTrayPopupMinWidth,
562 kTrayPopupMaxWidth); 559 kTrayPopupMaxWidth);
563 init_params.first_item_has_no_margin = 560 init_params.first_item_has_no_margin = true;
564 ash::switches::UseAlternateShelfLayout();
565 init_params.arrow_color = kBackgroundColor; 561 init_params.arrow_color = kBackgroundColor;
566 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); 562 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]);
567 notification_bubble_.reset( 563 notification_bubble_.reset(
568 new internal::SystemBubbleWrapper(notification_bubble)); 564 new internal::SystemBubbleWrapper(notification_bubble));
569 notification_bubble_->InitView(this, anchor, &init_params, false); 565 notification_bubble_->InitView(this, anchor, &init_params, false);
570 566
571 if (notification_bubble->bubble_view()->child_count() == 0) { 567 if (notification_bubble->bubble_view()->child_count() == 0) {
572 // It is possible that none of the items generated actual notifications. 568 // It is possible that none of the items generated actual notifications.
573 DestroyNotificationBubble(); 569 DestroyNotificationBubble();
574 return; 570 return;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 system_bubble_.reset(); 719 system_bubble_.reset();
724 // When closing a system bubble with the alternate shelf layout, we need to 720 // When closing a system bubble with the alternate shelf layout, we need to
725 // turn off the active tinting of the shelf. 721 // turn off the active tinting of the shelf.
726 if (full_system_tray_menu_) { 722 if (full_system_tray_menu_) {
727 SetDrawBackgroundAsActive(false); 723 SetDrawBackgroundAsActive(false);
728 full_system_tray_menu_ = false; 724 full_system_tray_menu_ = false;
729 } 725 }
730 } 726 }
731 727
732 } // namespace ash 728 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698