| OLD | NEW |
| 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/tooltips/tooltip_controller.h" | 5 #include "ash/tooltips/tooltip_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 void TooltipController::SetTooltipsEnabled(bool enable) { | 245 void TooltipController::SetTooltipsEnabled(bool enable) { |
| 246 if (tooltips_enabled_ == enable) | 246 if (tooltips_enabled_ == enable) |
| 247 return; | 247 return; |
| 248 tooltips_enabled_ = enable; | 248 tooltips_enabled_ = enable; |
| 249 UpdateTooltip(tooltip_window_); | 249 UpdateTooltip(tooltip_window_); |
| 250 } | 250 } |
| 251 | 251 |
| 252 ui::EventResult TooltipController::OnKeyEvent(ui::KeyEvent* event) { | 252 void TooltipController::OnKeyEvent(ui::KeyEvent* event) { |
| 253 // On key press, we want to hide the tooltip and not show it until change. | 253 // On key press, we want to hide the tooltip and not show it until change. |
| 254 // This is the same behavior as hiding tooltips on timeout. Hence, we can | 254 // This is the same behavior as hiding tooltips on timeout. Hence, we can |
| 255 // simply simulate a timeout. | 255 // simply simulate a timeout. |
| 256 if (tooltip_shown_timer_.IsRunning()) { | 256 if (tooltip_shown_timer_.IsRunning()) { |
| 257 tooltip_shown_timer_.Stop(); | 257 tooltip_shown_timer_.Stop(); |
| 258 TooltipShownTimerFired(); | 258 TooltipShownTimerFired(); |
| 259 } | 259 } |
| 260 return ui::ER_UNHANDLED; | |
| 261 } | 260 } |
| 262 | 261 |
| 263 ui::EventResult TooltipController::OnMouseEvent(ui::MouseEvent* event) { | 262 ui::EventResult TooltipController::OnMouseEvent(ui::MouseEvent* event) { |
| 264 aura::Window* target = static_cast<aura::Window*>(event->target()); | 263 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 265 switch (event->type()) { | 264 switch (event->type()) { |
| 266 case ui::ET_MOUSE_MOVED: | 265 case ui::ET_MOUSE_MOVED: |
| 267 case ui::ET_MOUSE_DRAGGED: | 266 case ui::ET_MOUSE_DRAGGED: |
| 268 if (tooltip_window_ != target) { | 267 if (tooltip_window_ != target) { |
| 269 if (tooltip_window_) | 268 if (tooltip_window_) |
| 270 tooltip_window_->RemoveObserver(this); | 269 tooltip_window_->RemoveObserver(this); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 479 } |
| 481 | 480 |
| 482 TooltipController::Tooltip* TooltipController::GetTooltip() { | 481 TooltipController::Tooltip* TooltipController::GetTooltip() { |
| 483 if (!tooltip_.get()) | 482 if (!tooltip_.get()) |
| 484 tooltip_.reset(new Tooltip(this)); | 483 tooltip_.reset(new Tooltip(this)); |
| 485 return tooltip_.get(); | 484 return tooltip_.get(); |
| 486 } | 485 } |
| 487 | 486 |
| 488 } // namespace internal | 487 } // namespace internal |
| 489 } // namespace ash | 488 } // namespace ash |
| OLD | NEW |