| 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // visibility and this check below will have no effect. | 445 // visibility and this check below will have no effect. |
| 446 if (tooltip_text_ != tooltip_text || !GetTooltip()->IsVisible()) { | 446 if (tooltip_text_ != tooltip_text || !GetTooltip()->IsVisible()) { |
| 447 tooltip_shown_timer_.Stop(); | 447 tooltip_shown_timer_.Stop(); |
| 448 tooltip_text_ = tooltip_text; | 448 tooltip_text_ = tooltip_text; |
| 449 if (tooltip_text_.empty()) { | 449 if (tooltip_text_.empty()) { |
| 450 GetTooltip()->Hide(); | 450 GetTooltip()->Hide(); |
| 451 } else { | 451 } else { |
| 452 string16 tooltip_text(tooltip_text_); | 452 string16 tooltip_text(tooltip_text_); |
| 453 gfx::Point widget_loc = curr_mouse_loc_; | 453 gfx::Point widget_loc = curr_mouse_loc_; |
| 454 widget_loc = widget_loc.Add( | 454 widget_loc = widget_loc.Add( |
| 455 tooltip_window_->GetBoundsInScreen().origin()); | 455 tooltip_window_->GetBoundsInScreen().DistanceFromOrigin()); |
| 456 GetTooltip()->SetText(tooltip_text, widget_loc); | 456 GetTooltip()->SetText(tooltip_text, widget_loc); |
| 457 GetTooltip()->Show(); | 457 GetTooltip()->Show(); |
| 458 tooltip_shown_timer_.Start(FROM_HERE, | 458 tooltip_shown_timer_.Start(FROM_HERE, |
| 459 base::TimeDelta::FromMilliseconds(kTooltipShownTimeoutMs), | 459 base::TimeDelta::FromMilliseconds(kTooltipShownTimeoutMs), |
| 460 this, &TooltipController::TooltipShownTimerFired); | 460 this, &TooltipController::TooltipShownTimerFired); |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 } | 463 } |
| 464 | 464 |
| 465 bool TooltipController::IsTooltipVisible() { | 465 bool TooltipController::IsTooltipVisible() { |
| 466 return GetTooltip()->IsVisible(); | 466 return GetTooltip()->IsVisible(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 bool TooltipController::IsDragDropInProgress() { | 469 bool TooltipController::IsDragDropInProgress() { |
| 470 return drag_drop_client_->IsDragDropInProgress(); | 470 return drag_drop_client_->IsDragDropInProgress(); |
| 471 } | 471 } |
| 472 | 472 |
| 473 TooltipController::Tooltip* TooltipController::GetTooltip() { | 473 TooltipController::Tooltip* TooltipController::GetTooltip() { |
| 474 if (!tooltip_.get()) | 474 if (!tooltip_.get()) |
| 475 tooltip_.reset(new Tooltip); | 475 tooltip_.reset(new Tooltip); |
| 476 return tooltip_.get(); | 476 return tooltip_.get(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace internal | 479 } // namespace internal |
| 480 } // namespace ash | 480 } // namespace ash |
| OLD | NEW |