| 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" |
| 11 #include "ash/wm/cursor_manager.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/location.h" | 13 #include "base/location.h" |
| 13 #include "base/string_split.h" | 14 #include "base/string_split.h" |
| 14 #include "base/time.h" | 15 #include "base/time.h" |
| 15 #include "ui/aura/client/drag_drop_client.h" | 16 #include "ui/aura/client/drag_drop_client.h" |
| 16 #include "ui/aura/cursor_manager.h" | |
| 17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
| 18 #include "ui/aura/event.h" | 18 #include "ui/aura/event.h" |
| 19 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
| 20 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/base/text/text_elider.h" | 22 #include "ui/base/text/text_elider.h" |
| 23 #include "ui/gfx/font.h" | 23 #include "ui/gfx/font.h" |
| 24 #include "ui/gfx/point.h" | 24 #include "ui/gfx/point.h" |
| 25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 26 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 tooltip_->Hide(); | 397 tooltip_->Hide(); |
| 398 | 398 |
| 399 // Since the user presumably no longer needs the tooltip, we also stop the | 399 // Since the user presumably no longer needs the tooltip, we also stop the |
| 400 // tooltip timer so that tooltip does not pop back up. We will restart this | 400 // tooltip timer so that tooltip does not pop back up. We will restart this |
| 401 // timer if the tooltip changes (see UpdateTooltip()). | 401 // timer if the tooltip changes (see UpdateTooltip()). |
| 402 tooltip_timer_.Stop(); | 402 tooltip_timer_.Stop(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void TooltipController::UpdateIfRequired() { | 405 void TooltipController::UpdateIfRequired() { |
| 406 if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() || | 406 if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() || |
| 407 !aura::Env::GetInstance()->cursor_manager()->cursor_visible()) { | 407 !ash::Shell::GetInstance()->cursor_manager()->cursor_visible()) { |
| 408 tooltip_->Hide(); | 408 tooltip_->Hide(); |
| 409 return; | 409 return; |
| 410 } | 410 } |
| 411 | 411 |
| 412 string16 tooltip_text; | 412 string16 tooltip_text; |
| 413 if (tooltip_window_) | 413 if (tooltip_window_) |
| 414 tooltip_text = aura::client::GetTooltipText(tooltip_window_); | 414 tooltip_text = aura::client::GetTooltipText(tooltip_window_); |
| 415 | 415 |
| 416 // If the user pressed a mouse button. We will hide the tooltip and not show | 416 // If the user pressed a mouse button. We will hide the tooltip and not show |
| 417 // it until there is a change in the tooltip. | 417 // it until there is a change in the tooltip. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 bool TooltipController::IsTooltipVisible() { | 451 bool TooltipController::IsTooltipVisible() { |
| 452 return tooltip_->IsVisible(); | 452 return tooltip_->IsVisible(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 bool TooltipController::IsDragDropInProgress() { | 455 bool TooltipController::IsDragDropInProgress() { |
| 456 return drag_drop_client_->IsDragDropInProgress(); | 456 return drag_drop_client_->IsDragDropInProgress(); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace internal | 459 } // namespace internal |
| 460 } // namespace ash | 460 } // namespace ash |
| OLD | NEW |