OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/overflow_bubble.h" | 5 #include "ash/shelf/overflow_bubble.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
10 #include "ash/launcher/launcher_view.h" | 10 #include "ash/launcher/launcher_view.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 75 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
76 | 76 |
77 // ui::EventHandler overrides: | 77 // ui::EventHandler overrides: |
78 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 78 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
79 | 79 |
80 // views::BubbleDelegate overrides: | 80 // views::BubbleDelegate overrides: |
81 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | 81 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
82 | 82 |
83 ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const { | 83 ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const { |
84 return ShelfLayoutManager::ForLauncher( | 84 return ShelfLayoutManager::ForLauncher( |
85 anchor_view()->GetWidget()->GetNativeView()); | 85 GetAnchorView()->GetWidget()->GetNativeView()); |
86 } | 86 } |
87 | 87 |
88 LauncherView* launcher_view_; // Owned by views hierarchy. | 88 LauncherView* launcher_view_; // Owned by views hierarchy. |
89 gfx::Vector2d scroll_offset_; | 89 gfx::Vector2d scroll_offset_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); | 91 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); |
92 }; | 92 }; |
93 | 93 |
94 OverflowBubbleView::OverflowBubbleView() | 94 OverflowBubbleView::OverflowBubbleView() |
95 : launcher_view_(NULL) { | 95 : launcher_view_(NULL) { |
96 } | 96 } |
97 | 97 |
98 OverflowBubbleView::~OverflowBubbleView() { | 98 OverflowBubbleView::~OverflowBubbleView() { |
99 } | 99 } |
100 | 100 |
101 void OverflowBubbleView::InitOverflowBubble(views::View* anchor, | 101 void OverflowBubbleView::InitOverflowBubble(views::View* anchor, |
102 LauncherView* launcher_view) { | 102 LauncherView* launcher_view) { |
103 // set_anchor_view needs to be called before GetShelfLayoutManagerForLauncher | 103 // set_anchor_view needs to be called before GetShelfLayoutManagerForLauncher |
104 // can be called. | 104 // can be called. |
105 set_anchor_view(anchor); | 105 SetAnchorView(anchor); |
106 set_arrow(GetBubbleArrow()); | 106 set_arrow(GetBubbleArrow()); |
107 set_background(NULL); | 107 set_background(NULL); |
108 set_color(SkColorSetARGB(kLauncherBackgroundAlpha, 0, 0, 0)); | 108 set_color(SkColorSetARGB(kLauncherBackgroundAlpha, 0, 0, 0)); |
109 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); | 109 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); |
110 set_move_with_anchor(true); | 110 set_move_with_anchor(true); |
111 // Overflow bubble should not get focus. If it get focus when it is shown, | 111 // Overflow bubble should not get focus. If it get focus when it is shown, |
112 // active state item is changed to running state. | 112 // active state item is changed to running state. |
113 set_use_focusless(true); | 113 set_use_focusless(true); |
114 | 114 |
115 // Makes bubble view has a layer and clip its children layers. | 115 // Makes bubble view has a layer and clip its children layers. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 DCHECK(widget == bubble_->GetWidget()); | 313 DCHECK(widget == bubble_->GetWidget()); |
314 bubble_ = NULL; | 314 bubble_ = NULL; |
315 anchor_ = NULL; | 315 anchor_ = NULL; |
316 launcher_view_ = NULL; | 316 launcher_view_ = NULL; |
317 ShelfLayoutManager::ForLauncher( | 317 ShelfLayoutManager::ForLauncher( |
318 widget->GetNativeView())->shelf_widget()->launcher()->SchedulePaint(); | 318 widget->GetNativeView())->shelf_widget()->launcher()->SchedulePaint(); |
319 } | 319 } |
320 | 320 |
321 } // namespace internal | 321 } // namespace internal |
322 } // namespace ash | 322 } // namespace ash |
OLD | NEW |