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

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

Issue 23531033: Fixing various problems with the new shelf layout in conjunction with the blue tray background on b… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell/panel_window.h" 10 #include "ash/shell/panel_window.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 313 }
314 314
315 bool SystemTray::HasSystemBubble() const { 315 bool SystemTray::HasSystemBubble() const {
316 return system_bubble_.get() != NULL; 316 return system_bubble_.get() != NULL;
317 } 317 }
318 318
319 bool SystemTray::HasNotificationBubble() const { 319 bool SystemTray::HasNotificationBubble() const {
320 return notification_bubble_.get() != NULL; 320 return notification_bubble_.get() != NULL;
321 } 321 }
322 322
323 bool SystemTray::IsPressed() {
324 // Only when a full system tray bubble gets shown true will be returned.
325 // Small bubbles (like audio modifications via keyboard) should return false.
326 // Since showing the e.g. network portion of the system tray menu will convert
327 // the |system_bubble_| from type |BUBBLE_TYPE_DEFAULT| into
328 // |BUBBLE_TYPE_DETAILED| the full tray cannot reliably be checked trhough the
329 // type. As such |full_system_tray_menu_| gets checked here.
330 return HasSystemBubble() && full_system_tray_menu_;
331 }
332
333 internal::SystemTrayBubble* SystemTray::GetSystemBubble() { 323 internal::SystemTrayBubble* SystemTray::GetSystemBubble() {
334 if (!system_bubble_) 324 if (!system_bubble_)
335 return NULL; 325 return NULL;
336 return system_bubble_->bubble(); 326 return system_bubble_->bubble();
337 } 327 }
338 328
339 bool SystemTray::IsAnyBubbleVisible() const { 329 bool SystemTray::IsAnyBubbleVisible() const {
340 return ((system_bubble_.get() && 330 return ((system_bubble_.get() &&
341 system_bubble_->bubble()->IsVisible()) || 331 system_bubble_->bubble()->IsVisible()) ||
342 (notification_bubble_.get() && 332 (notification_bubble_.get() &&
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 465
476 if (detailed && items.size() > 0) 466 if (detailed && items.size() > 0)
477 detailed_item_ = items[0]; 467 detailed_item_ = items[0];
478 else 468 else
479 detailed_item_ = NULL; 469 detailed_item_ = NULL;
480 470
481 UpdateNotificationBubble(); // State changed, re-create notifications. 471 UpdateNotificationBubble(); // State changed, re-create notifications.
482 if (!notification_bubble_) 472 if (!notification_bubble_)
483 UpdateWebNotifications(); 473 UpdateWebNotifications();
484 GetShelfLayoutManager()->UpdateAutoHideState(); 474 GetShelfLayoutManager()->UpdateAutoHideState();
475
476 // When we show the system menu in our alternate shelf layout, we need to
477 // tint the background.
478 if (full_system_tray_menu_)
479 SetDrawBackgroundAsActive(true);
485 } 480 }
486 481
487 void SystemTray::UpdateNotificationBubble() { 482 void SystemTray::UpdateNotificationBubble() {
488 // Only show the notification bubble if we have notifications. 483 // Only show the notification bubble if we have notifications.
489 if (notification_items_.empty()) { 484 if (notification_items_.empty()) {
490 DestroyNotificationBubble(); 485 DestroyNotificationBubble();
491 return; 486 return;
492 } 487 }
493 // Destroy the existing bubble before constructing a new one. 488 // Destroy the existing bubble before constructing a new one.
494 notification_bubble_.reset(); 489 notification_bubble_.reset();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 579
585 base::string16 SystemTray::GetAccessibleNameForTray() { 580 base::string16 SystemTray::GetAccessibleNameForTray() {
586 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME); 581 return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
587 } 582 }
588 583
589 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) { 584 void SystemTray::HideBubbleWithView(const TrayBubbleView* bubble_view) {
590 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) { 585 if (system_bubble_.get() && bubble_view == system_bubble_->bubble_view()) {
591 DestroySystemBubble(); 586 DestroySystemBubble();
592 UpdateNotificationBubble(); // State changed, re-create notifications. 587 UpdateNotificationBubble(); // State changed, re-create notifications.
593 GetShelfLayoutManager()->UpdateAutoHideState(); 588 GetShelfLayoutManager()->UpdateAutoHideState();
589 // When closing a system bubble with the alternate shelf layout, we need to
590 // turn off the active tinting of the shelf.
591 if (full_system_tray_menu_) {
592 SetDrawBackgroundAsActive(false);
593 full_system_tray_menu_ = false;
594 }
594 } else if (notification_bubble_.get() && 595 } else if (notification_bubble_.get() &&
595 bubble_view == notification_bubble_->bubble_view()) { 596 bubble_view == notification_bubble_->bubble_view()) {
596 DestroyNotificationBubble(); 597 DestroyNotificationBubble();
597 } 598 }
598 } 599 }
599 600
600 bool SystemTray::ClickedOutsideBubble() { 601 bool SystemTray::ClickedOutsideBubble() {
601 if (!system_bubble_) 602 if (!system_bubble_)
602 return false; 603 return false;
603 HideBubbleWithView(system_bubble_->bubble_view()); 604 HideBubbleWithView(system_bubble_->bubble_view());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 ConvertPointToWidget(this, &point); 653 ConvertPointToWidget(this, &point);
653 arrow_offset = point.x(); 654 arrow_offset = point.x();
654 } 655 }
655 } 656 }
656 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); 657 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset);
657 } 658 }
658 return true; 659 return true;
659 } 660 }
660 661
661 } // namespace ash 662 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698