| OLD | NEW |
| 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_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (view->layer()) | 59 if (view->layer()) |
| 60 SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); | 60 SetFillsBoundsOpaquely(view->layer()->fills_bounds_opaquely()); |
| 61 AddChildView(view); | 61 AddChildView(view); |
| 62 SetVisible(view->visible()); | 62 SetVisible(view->visible()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual ~TrayPopupItemContainer() {} | 65 virtual ~TrayPopupItemContainer() {} |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 // Overridden from views::View. | 68 // Overridden from views::View. |
| 69 virtual void ChildVisibilityChanged(View* child) OVERRIDE { | 69 virtual void ChildVisibilityChanged(View* child) override { |
| 70 if (visible() == child->visible()) | 70 if (visible() == child->visible()) |
| 71 return; | 71 return; |
| 72 SetVisible(child->visible()); | 72 SetVisible(child->visible()); |
| 73 PreferredSizeChanged(); | 73 PreferredSizeChanged(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE { | 76 virtual void ChildPreferredSizeChanged(View* child) override { |
| 77 PreferredSizeChanged(); | 77 PreferredSizeChanged(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE { | 80 virtual void OnMouseEntered(const ui::MouseEvent& event) override { |
| 81 hover_ = true; | 81 hover_ = true; |
| 82 SchedulePaint(); | 82 SchedulePaint(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE { | 85 virtual void OnMouseExited(const ui::MouseEvent& event) override { |
| 86 hover_ = false; | 86 hover_ = false; |
| 87 SchedulePaint(); | 87 SchedulePaint(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE { | 90 virtual void OnPaintBackground(gfx::Canvas* canvas) override { |
| 91 if (child_count() == 0) | 91 if (child_count() == 0) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 views::View* view = child_at(0); | 94 views::View* view = child_at(0); |
| 95 if (!view->background()) { | 95 if (!view->background()) { |
| 96 canvas->FillRect(gfx::Rect(size()), (hover_ && change_background_) ? | 96 canvas->FillRect(gfx::Rect(size()), (hover_ && change_background_) ? |
| 97 kHoverBackgroundColor : kBackgroundColor); | 97 kHoverBackgroundColor : kBackgroundColor); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool hover_; | 101 bool hover_; |
| 102 bool change_background_; | 102 bool change_background_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer); | 104 DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 // Implicit animation observer that deletes itself and the layer at the end of | 107 // Implicit animation observer that deletes itself and the layer at the end of |
| 108 // the animation. | 108 // the animation. |
| 109 class AnimationObserverDeleteLayer : public ui::ImplicitAnimationObserver { | 109 class AnimationObserverDeleteLayer : public ui::ImplicitAnimationObserver { |
| 110 public: | 110 public: |
| 111 explicit AnimationObserverDeleteLayer(ui::Layer* layer) | 111 explicit AnimationObserverDeleteLayer(ui::Layer* layer) |
| 112 : layer_(layer) { | 112 : layer_(layer) { |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual ~AnimationObserverDeleteLayer() { | 115 virtual ~AnimationObserverDeleteLayer() { |
| 116 } | 116 } |
| 117 | 117 |
| 118 virtual void OnImplicitAnimationsCompleted() OVERRIDE { | 118 virtual void OnImplicitAnimationsCompleted() override { |
| 119 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, this); | 119 base::MessageLoopForUI::current()->DeleteSoon(FROM_HERE, this); |
| 120 } | 120 } |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 scoped_ptr<ui::Layer> layer_; | 123 scoped_ptr<ui::Layer> layer_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(AnimationObserverDeleteLayer); | 125 DISALLOW_COPY_AND_ASSIGN(AnimationObserverDeleteLayer); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace | 128 } // namespace |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // 2 items, which are the bottom header row and the one just above it. | 383 // 2 items, which are the bottom header row and the one just above it. |
| 384 bubble_view_->AddChildView(new TrayPopupItemContainer( | 384 bubble_view_->AddChildView(new TrayPopupItemContainer( |
| 385 item_views[i], is_default_bubble, | 385 item_views[i], is_default_bubble, |
| 386 is_default_bubble && (i < item_views.size() - 2))); | 386 is_default_bubble && (i < item_views.size() - 2))); |
| 387 } | 387 } |
| 388 if (focus_view) | 388 if (focus_view) |
| 389 focus_view->RequestFocus(); | 389 focus_view->RequestFocus(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace ash | 392 } // namespace ash |
| OLD | NEW |