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

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, 9 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 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 full_system_tray_menu_ = items.size() > 1; 473 full_system_tray_menu_ = items.size() > 1;
476 // The menu width is fixed, and it is a per language setting. 474 // The menu width is fixed, and it is a per language setting.
477 int menu_width = std::max(kMinimumSystemTrayMenuWidth, 475 int menu_width = std::max(kMinimumSystemTrayMenuWidth,
478 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth()); 476 Shell::GetInstance()->system_tray_delegate()->GetSystemTrayMenuWidth());
479 477
480 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, 478 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY,
481 GetAnchorAlignment(), 479 GetAnchorAlignment(),
482 menu_width, 480 menu_width,
483 kTrayPopupMaxWidth); 481 kTrayPopupMaxWidth);
484 init_params.can_activate = can_activate; 482 init_params.can_activate = can_activate;
485 init_params.first_item_has_no_margin = 483 init_params.first_item_has_no_margin = true;
486 ash::switches::UseAlternateShelfLayout();
487 if (detailed) { 484 if (detailed) {
488 // This is the case where a volume control or brightness control bubble 485 // This is the case where a volume control or brightness control bubble
489 // is created. 486 // is created.
490 init_params.max_height = default_bubble_height_; 487 init_params.max_height = default_bubble_height_;
491 init_params.arrow_color = kBackgroundColor; 488 init_params.arrow_color = kBackgroundColor;
492 } else { 489 } else {
493 init_params.arrow_color = kHeaderBackgroundColor; 490 init_params.arrow_color = kHeaderBackgroundColor;
494 } 491 }
495 init_params.arrow_offset = arrow_offset; 492 init_params.arrow_offset = arrow_offset;
496 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT) 493 if (bubble_type == SystemTrayBubble::BUBBLE_TYPE_DEFAULT)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 anchor = system_bubble_->bubble_view(); 544 anchor = system_bubble_->bubble_view();
548 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE; 545 anchor_type = TrayBubbleView::ANCHOR_TYPE_BUBBLE;
549 } else { 546 } else {
550 anchor = tray_container(); 547 anchor = tray_container();
551 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY; 548 anchor_type = TrayBubbleView::ANCHOR_TYPE_TRAY;
552 } 549 }
553 TrayBubbleView::InitParams init_params(anchor_type, 550 TrayBubbleView::InitParams init_params(anchor_type,
554 GetAnchorAlignment(), 551 GetAnchorAlignment(),
555 kTrayPopupMinWidth, 552 kTrayPopupMinWidth,
556 kTrayPopupMaxWidth); 553 kTrayPopupMaxWidth);
557 init_params.first_item_has_no_margin = 554 init_params.first_item_has_no_margin = true;
558 ash::switches::UseAlternateShelfLayout();
559 init_params.arrow_color = kBackgroundColor; 555 init_params.arrow_color = kBackgroundColor;
560 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]); 556 init_params.arrow_offset = GetTrayXOffset(notification_items_[0]);
561 notification_bubble_.reset( 557 notification_bubble_.reset(
562 new internal::SystemBubbleWrapper(notification_bubble)); 558 new internal::SystemBubbleWrapper(notification_bubble));
563 notification_bubble_->InitView(this, anchor, &init_params, false); 559 notification_bubble_->InitView(this, anchor, &init_params, false);
564 560
565 if (notification_bubble->bubble_view()->child_count() == 0) { 561 if (notification_bubble->bubble_view()->child_count() == 0) {
566 // It is possible that none of the items generated actual notifications. 562 // It is possible that none of the items generated actual notifications.
567 DestroyNotificationBubble(); 563 DestroyNotificationBubble();
568 return; 564 return;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 system_bubble_.reset(); 717 system_bubble_.reset();
722 // When closing a system bubble with the alternate shelf layout, we need to 718 // When closing a system bubble with the alternate shelf layout, we need to
723 // turn off the active tinting of the shelf. 719 // turn off the active tinting of the shelf.
724 if (full_system_tray_menu_) { 720 if (full_system_tray_menu_) {
725 SetDrawBackgroundAsActive(false); 721 SetDrawBackgroundAsActive(false);
726 full_system_tray_menu_ = false; 722 full_system_tray_menu_ = false;
727 } 723 }
728 } 724 }
729 725
730 } // namespace ash 726 } // 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