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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 label_.set_background( | 97 label_.set_background( |
98 views::Background::CreateSolidBackground(kTooltipBackground)); | 98 views::Background::CreateSolidBackground(kTooltipBackground)); |
99 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows)) { | 99 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows)) { |
100 label_.set_border( | 100 label_.set_border( |
101 views::Border::CreateSolidBorder(kTooltipBorderWidth, | 101 views::Border::CreateSolidBorder(kTooltipBorderWidth, |
102 kTooltipBorder)); | 102 kTooltipBorder)); |
103 } | 103 } |
104 label_.set_owned_by_client(); | 104 label_.set_owned_by_client(); |
105 widget_.reset(CreateTooltip()); | 105 widget_.reset(CreateTooltip()); |
106 widget_->SetContentsView(&label_); | 106 widget_->SetContentsView(&label_); |
107 widget_->Activate(); | |
108 } | 107 } |
109 | 108 |
110 ~Tooltip() { | 109 ~Tooltip() { |
111 widget_->Close(); | 110 widget_->Close(); |
112 } | 111 } |
113 | 112 |
114 // Updates the text on the tooltip and resizes to fit. | 113 // Updates the text on the tooltip and resizes to fit. |
115 void SetText(string16 tooltip_text, gfx::Point location) { | 114 void SetText(string16 tooltip_text, gfx::Point location) { |
116 int max_width, line_count; | 115 int max_width, line_count; |
117 TrimTooltipToFit(&tooltip_text, &max_width, &line_count, | 116 TrimTooltipToFit(&tooltip_text, &max_width, &line_count, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 bool TooltipController::IsTooltipVisible() { | 419 bool TooltipController::IsTooltipVisible() { |
421 return tooltip_->IsVisible(); | 420 return tooltip_->IsVisible(); |
422 } | 421 } |
423 | 422 |
424 bool TooltipController::IsDragDropInProgress() { | 423 bool TooltipController::IsDragDropInProgress() { |
425 return drag_drop_client_->IsDragDropInProgress(); | 424 return drag_drop_client_->IsDragDropInProgress(); |
426 } | 425 } |
427 | 426 |
428 } // namespace internal | 427 } // namespace internal |
429 } // namespace ash | 428 } // namespace ash |
OLD | NEW |