OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf_tooltip_manager.h" | 5 #include "ash/shelf/shelf_tooltip_manager.h" |
6 | 6 |
7 #include "ash/shelf/shelf_layout_manager.h" | 7 #include "ash/shelf/shelf_layout_manager.h" |
8 #include "ash/shelf/shelf_view.h" | 8 #include "ash/shelf/shelf_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ShelfTooltipManager* host); | 53 ShelfTooltipManager* host); |
54 | 54 |
55 void SetText(const base::string16& text); | 55 void SetText(const base::string16& text); |
56 void Close(); | 56 void Close(); |
57 | 57 |
58 private: | 58 private: |
59 // views::WidgetDelegate overrides: | 59 // views::WidgetDelegate overrides: |
60 virtual void WindowClosing() OVERRIDE; | 60 virtual void WindowClosing() OVERRIDE; |
61 | 61 |
62 // views::View overrides: | 62 // views::View overrides: |
63 virtual gfx::Size GetPreferredSize() OVERRIDE; | 63 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
64 | 64 |
65 ShelfTooltipManager* host_; | 65 ShelfTooltipManager* host_; |
66 views::Label* label_; | 66 views::Label* label_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipBubble); | 68 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipBubble); |
69 }; | 69 }; |
70 | 70 |
71 ShelfTooltipManager::ShelfTooltipBubble::ShelfTooltipBubble( | 71 ShelfTooltipManager::ShelfTooltipBubble::ShelfTooltipBubble( |
72 views::View* anchor, | 72 views::View* anchor, |
73 views::BubbleBorder::Arrow arrow, | 73 views::BubbleBorder::Arrow arrow, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 GetWidget()->Close(); | 117 GetWidget()->Close(); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void ShelfTooltipManager::ShelfTooltipBubble::WindowClosing() { | 121 void ShelfTooltipManager::ShelfTooltipBubble::WindowClosing() { |
122 views::BubbleDelegateView::WindowClosing(); | 122 views::BubbleDelegateView::WindowClosing(); |
123 if (host_) | 123 if (host_) |
124 host_->OnBubbleClosed(this); | 124 host_->OnBubbleClosed(this); |
125 } | 125 } |
126 | 126 |
127 gfx::Size ShelfTooltipManager::ShelfTooltipBubble::GetPreferredSize() { | 127 gfx::Size ShelfTooltipManager::ShelfTooltipBubble::GetPreferredSize() const { |
128 gfx::Size pref_size = views::BubbleDelegateView::GetPreferredSize(); | 128 gfx::Size pref_size = views::BubbleDelegateView::GetPreferredSize(); |
129 if (pref_size.height() < kTooltipMinHeight) | 129 if (pref_size.height() < kTooltipMinHeight) |
130 pref_size.set_height(kTooltipMinHeight); | 130 pref_size.set_height(kTooltipMinHeight); |
131 if (pref_size.width() > kTooltipMaxWidth) | 131 if (pref_size.width() > kTooltipMaxWidth) |
132 pref_size.set_width(kTooltipMaxWidth); | 132 pref_size.set_width(kTooltipMaxWidth); |
133 return pref_size; | 133 return pref_size; |
134 } | 134 } |
135 | 135 |
136 ShelfTooltipManager::ShelfTooltipManager( | 136 ShelfTooltipManager::ShelfTooltipManager( |
137 ShelfLayoutManager* shelf_layout_manager, | 137 ShelfLayoutManager* shelf_layout_manager, |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 base::OneShotTimer<ShelfTooltipManager>* new_timer = | 366 base::OneShotTimer<ShelfTooltipManager>* new_timer = |
367 new base::OneShotTimer<ShelfTooltipManager>(); | 367 new base::OneShotTimer<ShelfTooltipManager>(); |
368 new_timer->Start(FROM_HERE, | 368 new_timer->Start(FROM_HERE, |
369 base::TimeDelta::FromMilliseconds(delay_in_ms), | 369 base::TimeDelta::FromMilliseconds(delay_in_ms), |
370 this, | 370 this, |
371 &ShelfTooltipManager::ShowInternal); | 371 &ShelfTooltipManager::ShowInternal); |
372 timer_.reset(new_timer); | 372 timer_.reset(new_timer); |
373 } | 373 } |
374 | 374 |
375 } // namespace ash | 375 } // namespace ash |
OLD | NEW |