| 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/common/shelf/shelf_tooltip_manager.h" | 5 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_view.h" | 7 #include "ash/common/shelf/shelf_view.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" | 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/shell_window_ids.h" | 9 #include "ash/common/shell_window_ids.h" |
| 10 #include "ash/common/wm_lookup.h" | 10 #include "ash/common/wm_lookup.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipBubble); | 114 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipBubble); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view) | 117 ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view) |
| 118 : timer_delay_(kTooltipAppearanceDelay), | 118 : timer_delay_(kTooltipAppearanceDelay), |
| 119 shelf_view_(shelf_view), | 119 shelf_view_(shelf_view), |
| 120 bubble_(nullptr), | 120 bubble_(nullptr), |
| 121 weak_factory_(this) { | 121 weak_factory_(this) { |
| 122 shelf_view_->wm_shelf()->AddObserver(this); | 122 shelf_view_->wm_shelf()->AddObserver(this); |
| 123 const bool wants_moves = false; | 123 const bool wants_moves = false; |
| 124 WmShell::Get()->AddPointerWatcher(this, wants_moves); | 124 const bool wants_drags = false; |
| 125 WmShell::Get()->AddPointerWatcher(this, wants_moves, wants_drags); |
| 125 } | 126 } |
| 126 | 127 |
| 127 ShelfTooltipManager::~ShelfTooltipManager() { | 128 ShelfTooltipManager::~ShelfTooltipManager() { |
| 128 WmShell::Get()->RemovePointerWatcher(this); | 129 WmShell::Get()->RemovePointerWatcher(this); |
| 129 shelf_view_->wm_shelf()->RemoveObserver(this); | 130 shelf_view_->wm_shelf()->RemoveObserver(this); |
| 130 WmWindow* window = nullptr; | 131 WmWindow* window = nullptr; |
| 131 if (shelf_view_->GetWidget()) | 132 if (shelf_view_->GetWidget()) |
| 132 window = WmLookup::Get()->GetWindowForWidget(shelf_view_->GetWidget()); | 133 window = WmLookup::Get()->GetWindowForWidget(shelf_view_->GetWidget()); |
| 133 if (window) | 134 if (window) |
| 134 window->RemoveLimitedPreTargetHandler(this); | 135 window->RemoveLimitedPreTargetHandler(this); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); | 249 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); |
| 249 } | 250 } |
| 250 } | 251 } |
| 251 | 252 |
| 252 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { | 253 bool ShelfTooltipManager::ShouldShowTooltipForView(views::View* view) { |
| 253 return shelf_view_ && shelf_view_->ShouldShowTooltipForView(view) && | 254 return shelf_view_ && shelf_view_->ShouldShowTooltipForView(view) && |
| 254 shelf_view_->wm_shelf()->GetVisibilityState() == SHELF_VISIBLE; | 255 shelf_view_->wm_shelf()->GetVisibilityState() == SHELF_VISIBLE; |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace ash | 258 } // namespace ash |
| OLD | NEW |