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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // want to update the tooltip because the timer has fired. | 398 // want to update the tooltip because the timer has fired. |
399 // If we come here from UpdateTooltip(), we have already checked for tooltip | 399 // If we come here from UpdateTooltip(), we have already checked for tooltip |
400 // visibility and this check below will have no effect. | 400 // visibility and this check below will have no effect. |
401 if (tooltip_text_ != tooltip_text || !tooltip_->IsVisible()) { | 401 if (tooltip_text_ != tooltip_text || !tooltip_->IsVisible()) { |
402 tooltip_text_ = tooltip_text; | 402 tooltip_text_ = tooltip_text; |
403 if (tooltip_text_.empty()) { | 403 if (tooltip_text_.empty()) { |
404 tooltip_->Hide(); | 404 tooltip_->Hide(); |
405 } else { | 405 } else { |
406 string16 tooltip_text(tooltip_text_); | 406 string16 tooltip_text(tooltip_text_); |
407 gfx::Point widget_loc = curr_mouse_loc_; | 407 gfx::Point widget_loc = curr_mouse_loc_; |
408 widget_loc = widget_loc.Add(tooltip_window_->GetScreenBounds().origin()); | 408 widget_loc = widget_loc.Add( |
| 409 tooltip_window_->GetBoundsInRootWindow().origin()); |
409 tooltip_->SetText(tooltip_text, widget_loc); | 410 tooltip_->SetText(tooltip_text, widget_loc); |
410 tooltip_->Show(); | 411 tooltip_->Show(); |
411 } | 412 } |
412 } | 413 } |
413 } | 414 } |
414 | 415 |
415 bool TooltipController::IsTooltipVisible() { | 416 bool TooltipController::IsTooltipVisible() { |
416 return tooltip_->IsVisible(); | 417 return tooltip_->IsVisible(); |
417 } | 418 } |
418 | 419 |
419 bool TooltipController::IsDragDropInProgress() { | 420 bool TooltipController::IsDragDropInProgress() { |
420 aura::client::DragDropClient* client = aura::client::GetDragDropClient( | 421 aura::client::DragDropClient* client = aura::client::GetDragDropClient( |
421 Shell::GetRootWindow()); | 422 Shell::GetRootWindow()); |
422 if (client) | 423 if (client) |
423 return client->IsDragDropInProgress(); | 424 return client->IsDragDropInProgress(); |
424 return false; | 425 return false; |
425 } | 426 } |
426 | 427 |
427 } // namespace internal | 428 } // namespace internal |
428 } // namespace ash | 429 } // namespace ash |
OLD | NEW |