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

Unified Diff: ash/system/tray/system_tray.cc

Issue 10834338: Move non SystemTray specific code to TrayBackgroundView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/tray/system_tray.h ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 2b7dc1e5d1e1cb6bf02f8035cbd3bc30c8af1245..c089947b6eeb0ff9baadcddfe90c3d04141ad83e 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -51,39 +51,9 @@
namespace ash {
-namespace internal {
-
-// Observe the tray layer animation and update the anchor when it changes.
-// TODO(stevenjb): Observe or mirror the actual animation, not just the start
-// and end points.
-class SystemTrayLayerAnimationObserver : public ui::LayerAnimationObserver {
- public:
- explicit SystemTrayLayerAnimationObserver(SystemTray* host) : host_(host) {}
-
- virtual void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) {
- host_->UpdateNotificationAnchor();
- }
-
- virtual void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) {
- host_->UpdateNotificationAnchor();
- }
-
- virtual void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) {
- host_->UpdateNotificationAnchor();
- }
-
- private:
- SystemTray* host_;
-
- DISALLOW_COPY_AND_ASSIGN(SystemTrayLayerAnimationObserver);
-};
-
-} // namespace internal
-
// SystemTray
using internal::SystemTrayBubble;
-using internal::SystemTrayLayerAnimationObserver;
using internal::TrayBubbleView;
SystemTray::SystemTray(internal::StatusAreaWidget* status_area_widget)
@@ -113,14 +83,6 @@ SystemTray::~SystemTray() {
++it) {
(*it)->DestroyTrayView();
}
- GetWidget()->GetNativeView()->layer()->GetAnimator()->RemoveObserver(
- layer_animation_observer_.get());
-}
-
-void SystemTray::Initialize() {
- layer_animation_observer_.reset(new SystemTrayLayerAnimationObserver(this));
- GetWidget()->GetNativeView()->layer()->GetAnimator()->AddObserver(
- layer_animation_observer_.get());
}
void SystemTray::CreateItems() {
@@ -181,8 +143,7 @@ void SystemTray::AddTrayItem(SystemTrayItem* item) {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
views::View* tray_item = item->CreateTrayView(delegate->GetUserLoginStatus());
- item->UpdateAfterShelfAlignmentChange(
- ash::Shell::GetInstance()->system_tray()->shelf_alignment());
+ item->UpdateAfterShelfAlignmentChange(shelf_alignment());
if (tray_item) {
tray_container()->AddChildViewAt(tray_item, 0);
@@ -435,12 +396,9 @@ void SystemTray::UpdateNotificationBubble() {
status_area_widget()->HideNonSystemNotifications();
}
-void SystemTray::UpdateNotificationAnchor() {
- if (!notification_bubble_.get())
- return;
- notification_bubble_->bubble_view()->UpdateBubble();
- // Ensure that the notification buble is above the launcher/status area.
- notification_bubble_->bubble_view()->GetWidget()->StackAtTop();
+void SystemTray::Initialize() {
+ internal::TrayBackgroundView::Initialize();
+ CreateItems();
}
void SystemTray::SetShelfAlignment(ShelfAlignment alignment) {
@@ -457,6 +415,16 @@ void SystemTray::SetShelfAlignment(ShelfAlignment alignment) {
}
}
+void SystemTray::AnchorUpdated() {
+ if (notification_bubble_.get()) {
+ notification_bubble_->bubble_view()->UpdateBubble();
+ // Ensure that the notification buble is above the launcher/status area.
+ notification_bubble_->bubble_view()->GetWidget()->StackAtTop();
+ }
+ if (bubble_.get())
+ bubble_->bubble_view()->UpdateBubble();
+}
+
bool SystemTray::PerformAction(const ui::Event& event) {
// If we're already showing the default view, hide it; otherwise, show it
// (and hide any popup that's currently shown).
@@ -491,24 +459,10 @@ void SystemTray::OnMouseExited(const ui::MouseEvent& event) {
should_show_launcher_ = false;
}
-void SystemTray::AboutToRequestFocusFromTabTraversal(bool reverse) {
- views::View* v = GetNextFocusableView();
- if (v)
- v->AboutToRequestFocusFromTabTraversal(reverse);
-}
-
void SystemTray::GetAccessibleState(ui::AccessibleViewState* state) {
state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
state->name = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
}
-void SystemTray::OnPaintFocusBorder(gfx::Canvas* canvas) {
- // The tray itself expands to the right and bottom edge of the screen to make
- // sure clicking on the edges brings up the popup. However, the focus border
- // should be only around the container.
- if (GetWidget() && GetWidget()->IsActive())
- DrawBorder(canvas, GetContentsBounds());
-}
-
} // namespace ash
« no previous file with comments | « ash/system/tray/system_tray.h ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698