Chromium Code Reviews| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; | 74 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; |
| 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 DCHECK(AnchorView()); | |
|
msw
2013/09/27 18:20:31
nit: Remove this. DCHECKing just before a potentia
Mr4D (OOO till 08-26)
2013/09/27 20:29:35
Done.
| |
| 84 return ShelfLayoutManager::ForLauncher( | 85 return ShelfLayoutManager::ForLauncher( |
| 85 anchor_view()->GetWidget()->GetNativeView()); | 86 AnchorView()->GetWidget()->GetNativeView()); |
| 86 } | 87 } |
| 87 | 88 |
| 88 LauncherView* launcher_view_; // Owned by views hierarchy. | 89 LauncherView* launcher_view_; // Owned by views hierarchy. |
| 89 gfx::Vector2d scroll_offset_; | 90 gfx::Vector2d scroll_offset_; |
| 90 | 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); | 92 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 OverflowBubbleView::OverflowBubbleView() | 95 OverflowBubbleView::OverflowBubbleView() |
| 95 : launcher_view_(NULL) { | 96 : launcher_view_(NULL) { |
| 96 } | 97 } |
| 97 | 98 |
| 98 OverflowBubbleView::~OverflowBubbleView() { | 99 OverflowBubbleView::~OverflowBubbleView() { |
| 99 } | 100 } |
| 100 | 101 |
| 101 void OverflowBubbleView::InitOverflowBubble(views::View* anchor, | 102 void OverflowBubbleView::InitOverflowBubble(views::View* anchor, |
| 102 LauncherView* launcher_view) { | 103 LauncherView* launcher_view) { |
| 103 // set_anchor_view needs to be called before GetShelfLayoutManagerForLauncher | 104 // set_anchor_view needs to be called before GetShelfLayoutManagerForLauncher |
| 104 // can be called. | 105 // can be called. |
| 105 set_anchor_view(anchor); | 106 SetAnchorView(anchor); |
| 106 set_arrow(GetBubbleArrow()); | 107 set_arrow(GetBubbleArrow()); |
| 107 set_background(NULL); | 108 set_background(NULL); |
| 108 set_color(SkColorSetARGB(kLauncherBackgroundAlpha, 0, 0, 0)); | 109 set_color(SkColorSetARGB(kLauncherBackgroundAlpha, 0, 0, 0)); |
| 109 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); | 110 set_margins(gfx::Insets(kPadding, kPadding, kPadding, kPadding)); |
| 110 set_move_with_anchor(true); | 111 set_move_with_anchor(true); |
| 111 // Overflow bubble should not get focus. If it get focus when it is shown, | 112 // Overflow bubble should not get focus. If it get focus when it is shown, |
| 112 // active state item is changed to running state. | 113 // active state item is changed to running state. |
| 113 set_use_focusless(true); | 114 set_use_focusless(true); |
| 114 | 115 |
| 115 // Makes bubble view has a layer and clip its children layers. | 116 // 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()); | 314 DCHECK(widget == bubble_->GetWidget()); |
| 314 bubble_ = NULL; | 315 bubble_ = NULL; |
| 315 anchor_ = NULL; | 316 anchor_ = NULL; |
| 316 launcher_view_ = NULL; | 317 launcher_view_ = NULL; |
| 317 ShelfLayoutManager::ForLauncher( | 318 ShelfLayoutManager::ForLauncher( |
| 318 widget->GetNativeView())->shelf_widget()->launcher()->SchedulePaint(); | 319 widget->GetNativeView())->shelf_widget()->launcher()->SchedulePaint(); |
| 319 } | 320 } |
| 320 | 321 |
| 321 } // namespace internal | 322 } // namespace internal |
| 322 } // namespace ash | 323 } // namespace ash |
| OLD | NEW |