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

Side by Side Diff: ash/launcher/launcher_view.cc

Issue 10808102: Add EventFilter for LauncherTooltip (2nd try). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/launcher/launcher_view.h" 5 #include "ash/launcher/launcher_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/launcher/app_list_button.h" 9 #include "ash/launcher/app_list_button.h"
10 #include "ash/launcher/launcher_button.h" 10 #include "ash/launcher/launcher_button.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 drag_offset_(0), 276 drag_offset_(0),
277 start_drag_index_(-1), 277 start_drag_index_(-1),
278 context_menu_id_(0), 278 context_menu_id_(0),
279 alignment_(SHELF_ALIGNMENT_BOTTOM), 279 alignment_(SHELF_ALIGNMENT_BOTTOM),
280 leading_inset_(kDefaultLeadingInset) { 280 leading_inset_(kDefaultLeadingInset) {
281 DCHECK(model_); 281 DCHECK(model_);
282 bounds_animator_.reset(new views::BoundsAnimator(this)); 282 bounds_animator_.reset(new views::BoundsAnimator(this));
283 bounds_animator_->AddObserver(this); 283 bounds_animator_->AddObserver(this);
284 set_context_menu_controller(this); 284 set_context_menu_controller(this);
285 focus_search_.reset(new LauncherFocusSearch(view_model_.get())); 285 focus_search_.reset(new LauncherFocusSearch(view_model_.get()));
286 tooltip_.reset(new LauncherTooltipManager(alignment_, shelf_layout_manager)); 286 tooltip_.reset(new LauncherTooltipManager(
287 alignment_, shelf_layout_manager, this));
287 } 288 }
288 289
289 LauncherView::~LauncherView() { 290 LauncherView::~LauncherView() {
290 bounds_animator_->RemoveObserver(this); 291 bounds_animator_->RemoveObserver(this);
291 model_->RemoveObserver(this); 292 model_->RemoveObserver(this);
292 } 293 }
293 294
294 void LauncherView::Init() { 295 void LauncherView::Init() {
295 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 296 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
296 model_->AddObserver(this); 297 model_->AddObserver(this);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 OnLauncherIconPositionsChanged()); 808 OnLauncherIconPositionsChanged());
808 809
809 if (IsShowingOverflowBubble()) 810 if (IsShowingOverflowBubble())
810 overflow_bubble_->Hide(); 811 overflow_bubble_->Hide();
811 } 812 }
812 813
813 views::FocusTraversable* LauncherView::GetPaneFocusTraversable() { 814 views::FocusTraversable* LauncherView::GetPaneFocusTraversable() {
814 return this; 815 return this;
815 } 816 }
816 817
817 void LauncherView::OnMouseMoved(const views::MouseEvent& event) {
818 if (ShouldHideTooltip(event.location()) && tooltip_->IsVisible())
819 tooltip_->Close();
820 }
821
822 void LauncherView::OnMouseExited(const views::MouseEvent& event) {
823 // Mouse exit events are fired for entering to a launcher button from
824 // the launcher view, so it checks the location by ShouldHideTooltip().
825 gfx::Point point = event.location();
826 views::View::ConvertPointToView(parent(), this, &point);
827 if (ShouldHideTooltip(point) && tooltip_->IsVisible())
828 tooltip_->Close();
829 }
830
831 void LauncherView::LauncherItemAdded(int model_index) { 818 void LauncherView::LauncherItemAdded(int model_index) {
832 model_index = CancelDrag(model_index); 819 model_index = CancelDrag(model_index);
833 views::View* view = CreateViewForItem(model_->items()[model_index]); 820 views::View* view = CreateViewForItem(model_->items()[model_index]);
834 AddChildView(view); 821 AddChildView(view);
835 // Hide the view, it'll be made visible when the animation is done. Using 822 // Hide the view, it'll be made visible when the animation is done. Using
836 // opacity 0 here to avoid messing with CalculateIdealBounds which touches 823 // opacity 0 here to avoid messing with CalculateIdealBounds which touches
837 // the view's visibility. 824 // the view's visibility.
838 view->layer()->SetOpacity(0); 825 view->layer()->SetOpacity(0);
839 view_model_->Add(view, model_index); 826 view_model_->Add(view, model_index);
840 827
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1077 FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
1091 OnLauncherIconPositionsChanged()); 1078 OnLauncherIconPositionsChanged());
1092 PreferredSizeChanged(); 1079 PreferredSizeChanged();
1093 } 1080 }
1094 1081
1095 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { 1082 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
1096 } 1083 }
1097 1084
1098 } // namespace internal 1085 } // namespace internal
1099 } // namespace ash 1086 } // namespace ash
OLDNEW
« ash/launcher/launcher_tooltip_manager.cc ('K') | « ash/launcher/launcher_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698