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

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

Issue 229453005: Shelf Cleanup AlternateShelfLayout P1 Attempt 3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.cc » ('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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Initializes the bubble view and creates |bubble_wrapper_|. 85 // Initializes the bubble view and creates |bubble_wrapper_|.
86 void InitView(TrayBackgroundView* tray, 86 void InitView(TrayBackgroundView* tray,
87 views::View* anchor, 87 views::View* anchor,
88 TrayBubbleView::InitParams* init_params, 88 TrayBubbleView::InitParams* init_params,
89 bool is_persistent) { 89 bool is_persistent) {
90 DCHECK(anchor); 90 DCHECK(anchor);
91 user::LoginStatus login_status = 91 user::LoginStatus login_status =
92 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); 92 Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus();
93 bubble_->InitView(anchor, login_status, init_params); 93 bubble_->InitView(anchor, login_status, init_params);
94 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_->bubble_view())); 94 bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_->bubble_view()));
95 if (ash::switches::UseAlternateShelfLayout()) { 95 // The system bubble should not have an arrow.
96 // The system bubble should not have an arrow. 96 bubble_->bubble_view()->SetArrowPaintType(
97 bubble_->bubble_view()->SetArrowPaintType( 97 views::BubbleBorder::PAINT_NONE);
98 views::BubbleBorder::PAINT_NONE);
99 }
100 is_persistent_ = is_persistent; 98 is_persistent_ = is_persistent;
101 99
102 // If ChromeVox is enabled, focus the default item if no item is focused. 100 // If ChromeVox is enabled, focus the default item if no item is focused.
103 if (Shell::GetInstance()->accessibility_delegate()-> 101 if (Shell::GetInstance()->accessibility_delegate()->
104 IsSpokenFeedbackEnabled()) { 102 IsSpokenFeedbackEnabled()) {
105 bubble_->FocusDefaultIfNeeded(); 103 bubble_->FocusDefaultIfNeeded();
106 } 104 }
107 } 105 }
108 106
109 // Convenience accessors: 107 // Convenience accessors:
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 full_system_tray_menu_ = items.size() > 1; 470 full_system_tray_menu_ = items.size() > 1;
473 // The menu width is fixed, and it is a per language setting. 471 // The menu width is fixed, and it is a per language setting.
474 int menu_width = std::max(kMinimumSystemTrayMenuWidth, 472 int menu_width = std::max(kMinimumSystemTrayMenuWidth,
475 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); 473 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth());
476 474
477 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, 475 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY,
478 GetAnchorAlignment(), 476 GetAnchorAlignment(),
479 menu_width, 477 menu_width,
480 kTrayPopupMaxWidth); 478 kTrayPopupMaxWidth);
481 init_params.can_activate = can_activate; 479 init_params.can_activate = can_activate;
482 init_params.first_item_has_no_margin = 480 init_params.first_item_has_no_margin = true;
483 ash::switches::UseAlternateShelfLayout();
484 if (detailed) { 481 if (detailed) {
485 // This is the case where a volume control or brightness control bubble 482 // This is the case where a volume control or brightness control bubble
486 // is created. 483 // is created.
487 init_params.max_height = default_bubble_height_; 484 init_params.max_height = default_bubble_height_;
488 init_params.arrow_color = kBackgroundColor; 485 init_params.arrow_color = kBackgroundColor;
489 } else { 486 } else {
490 init_params.arrow_color = kHeaderBackgroundColor; 487 init_params.arrow_color = kHeaderBackgroundColor;
491 } 488 }
492 init_params.arrow_offset = arrow_offset; 489 init_params.arrow_offset = arrow_offset;
493 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) 490 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 anchor = system_bubble_->bubble_view(); 541 anchor = system_bubble_->bubble_view();
545 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; 542 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE;
546 } else { 543 } else {
547 anchor = tray_container(); 544 anchor = tray_container();
548 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; 545 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY;
549 } 546 }
550 TrayBubbleView::InitParams init_params(anchor_type, 547 TrayBubbleView::InitParams init_params(anchor_type,
551 GetAnchorAlignment(), 548 GetAnchorAlignment(),
552 kTrayPopupMinWidth, 549 kTrayPopupMinWidth,
553 kTrayPopupMaxWidth); 550 kTrayPopupMaxWidth);
554 init_params.first_item_has_no_margin = 551 init_params.first_item_has_no_margin = true;
555 ash::switches::UseAlternateShelfLayout();
556 init_params.arrow_color = kBackgroundColor; 552 init_params.arrow_color = kBackgroundColor;
557 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); 553 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]);
558 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble)); 554 notification_bubble_.reset(new SystemBubbleWrapper(notification_bubble));
559 notification_bubble_->InitView(this, anchor, &init_params, false); 555 notification_bubble_->InitView(this, anchor, &init_params, false);
560 556
561 if (notification_bubble->bubble_view()->child_count() == 0) { 557 if (notification_bubble->bubble_view()->child_count() == 0) {
562 // It is possible that none of the items generated actual notifications. 558 // It is possible that none of the items generated actual notifications.
563 DestroyNotificationBubble(); 559 DestroyNotificationBubble();
564 return; 560 return;
565 } 561 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 system_bubble_.reset(); 706 system_bubble_.reset();
711 // When closing a system bubble with the alternate shelf layout, we need to 707 // When closing a system bubble with the alternate shelf layout, we need to
712 // turn off the active tinting of the shelf. 708 // turn off the active tinting of the shelf.
713 if (full_system_tray_menu_) { 709 if (full_system_tray_menu_) {
714 SetDrawBackgroundAsActive(false); 710 SetDrawBackgroundAsActive(false);
715 full_system_tray_menu_ = false; 711 full_system_tray_menu_ = false;
716 } 712 }
717 } 713 }
718 714
719 } // namespace ash 715 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget_delegate.cc ('k') | ash/system/tray/tray_background_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698