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

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

Issue 10810011: Add EventFilter for LauncherTooltip. (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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 OnLauncherIconPositionsChanged()); 806 OnLauncherIconPositionsChanged());
806 807
807 if (IsShowingOverflowBubble()) 808 if (IsShowingOverflowBubble())
808 overflow_bubble_->Hide(); 809 overflow_bubble_->Hide();
809 } 810 }
810 811
811 views::FocusTraversable* LauncherView::GetPaneFocusTraversable() { 812 views::FocusTraversable* LauncherView::GetPaneFocusTraversable() {
812 return this; 813 return this;
813 } 814 }
814 815
815 void LauncherView::OnMouseMoved(const views::MouseEvent& event) {
816 if (ShouldHideTooltip(event.location()) && tooltip_->IsVisible())
817 tooltip_->Close();
818 }
819
820 void LauncherView::OnMouseExited(const views::MouseEvent& event) {
821 // Mouse exit events are fired for entering to a launcher button from
822 // the launcher view, so it checks the location by ShouldHideTooltip().
823 gfx::Point point = event.location();
824 views::View::ConvertPointToView(parent(), this, &point);
825 if (ShouldHideTooltip(point) && tooltip_->IsVisible())
826 tooltip_->Close();
827 }
828
829 void LauncherView::LauncherItemAdded(int model_index) { 816 void LauncherView::LauncherItemAdded(int model_index) {
830 model_index = CancelDrag(model_index); 817 model_index = CancelDrag(model_index);
831 views::View* view = CreateViewForItem(model_->items()[model_index]); 818 views::View* view = CreateViewForItem(model_->items()[model_index]);
832 AddChildView(view); 819 AddChildView(view);
833 // Hide the view, it'll be made visible when the animation is done. Using 820 // Hide the view, it'll be made visible when the animation is done. Using
834 // opacity 0 here to avoid messing with CalculateIdealBounds which touches 821 // opacity 0 here to avoid messing with CalculateIdealBounds which touches
835 // the view's visibility. 822 // the view's visibility.
836 view->layer()->SetOpacity(0); 823 view->layer()->SetOpacity(0);
837 view_model_->Add(view, model_index); 824 view_model_->Add(view, model_index);
838 825
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1069 FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
1083 OnLauncherIconPositionsChanged()); 1070 OnLauncherIconPositionsChanged());
1084 PreferredSizeChanged(); 1071 PreferredSizeChanged();
1085 } 1072 }
1086 1073
1087 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { 1074 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
1088 } 1075 }
1089 1076
1090 } // namespace internal 1077 } // namespace internal
1091 } // namespace ash 1078 } // 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