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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 GetTooltip()->Hide(); | 396 GetTooltip()->Hide(); |
397 | 397 |
398 // Since the user presumably no longer needs the tooltip, we also stop the | 398 // Since the user presumably no longer needs the tooltip, we also stop the |
399 // tooltip timer so that tooltip does not pop back up. We will restart this | 399 // tooltip timer so that tooltip does not pop back up. We will restart this |
400 // timer if the tooltip changes (see UpdateTooltip()). | 400 // timer if the tooltip changes (see UpdateTooltip()). |
401 tooltip_timer_.Stop(); | 401 tooltip_timer_.Stop(); |
402 } | 402 } |
403 | 403 |
404 void TooltipController::UpdateIfRequired() { | 404 void TooltipController::UpdateIfRequired() { |
405 if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() || | 405 if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() || |
406 !aura::Env::GetInstance()->cursor_manager()->cursor_visible()) { | 406 !ash::Shell::GetInstance()->cursor_manager()->cursor_visible()) { |
407 GetTooltip()->Hide(); | 407 GetTooltip()->Hide(); |
408 return; | 408 return; |
409 } | 409 } |
410 | 410 |
411 string16 tooltip_text; | 411 string16 tooltip_text; |
412 if (tooltip_window_) | 412 if (tooltip_window_) |
413 tooltip_text = aura::client::GetTooltipText(tooltip_window_); | 413 tooltip_text = aura::client::GetTooltipText(tooltip_window_); |
414 | 414 |
415 // If the user pressed a mouse button. We will hide the tooltip and not show | 415 // If the user pressed a mouse button. We will hide the tooltip and not show |
416 // it until there is a change in the tooltip. | 416 // it until there is a change in the tooltip. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 456 } |
457 | 457 |
458 TooltipController::Tooltip* TooltipController::GetTooltip() { | 458 TooltipController::Tooltip* TooltipController::GetTooltip() { |
459 if (!tooltip_.get()) | 459 if (!tooltip_.get()) |
460 tooltip_.reset(new Tooltip); | 460 tooltip_.reset(new Tooltip); |
461 return tooltip_.get(); | 461 return tooltip_.get(); |
462 } | 462 } |
463 | 463 |
464 } // namespace internal | 464 } // namespace internal |
465 } // namespace ash | 465 } // namespace ash |
OLD | NEW |