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/launcher/launcher_tooltip_manager.h" | 5 #include "ash/launcher/launcher_tooltip_manager.h" |
6 | 6 |
7 #include "ash/launcher/launcher_view.h" | 7 #include "ash/launcher/launcher_view.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 LauncherTooltipManager::LauncherTooltipBubble::LauncherTooltipBubble( | 89 LauncherTooltipManager::LauncherTooltipBubble::LauncherTooltipBubble( |
90 views::View* anchor, | 90 views::View* anchor, |
91 views::BubbleBorder::ArrowLocation arrow_location, | 91 views::BubbleBorder::ArrowLocation arrow_location, |
92 LauncherTooltipManager* host) | 92 LauncherTooltipManager* host) |
93 : views::BubbleDelegateView(anchor, arrow_location), | 93 : views::BubbleDelegateView(anchor, arrow_location), |
94 host_(host), | 94 host_(host), |
95 bubble_border_(NULL) { | 95 bubble_border_(NULL) { |
96 set_close_on_esc(false); | 96 set_close_on_esc(false); |
97 set_close_on_deactivate(false); | 97 set_close_on_deactivate(false); |
98 set_use_focusless(true); | 98 set_use_focusless(true); |
| 99 set_accept_events(false); |
99 set_margins(gfx::Insets(kTooltipTopBottomMargin, kTooltipLeftRightMargin, | 100 set_margins(gfx::Insets(kTooltipTopBottomMargin, kTooltipLeftRightMargin, |
100 kTooltipTopBottomMargin, kTooltipLeftRightMargin)); | 101 kTooltipTopBottomMargin, kTooltipLeftRightMargin)); |
101 SetLayoutManager(new views::FillLayout()); | 102 SetLayoutManager(new views::FillLayout()); |
102 // The anchor may not have the widget in tests. | 103 // The anchor may not have the widget in tests. |
103 if (anchor->GetWidget() && anchor->GetWidget()->GetNativeView()) { | 104 if (anchor->GetWidget() && anchor->GetWidget()->GetNativeView()) { |
104 aura::RootWindow* root_window = | 105 aura::RootWindow* root_window = |
105 anchor->GetWidget()->GetNativeView()->GetRootWindow(); | 106 anchor->GetWidget()->GetNativeView()->GetRootWindow(); |
106 set_parent_window(ash::Shell::GetInstance()->GetContainer( | 107 set_parent_window(ash::Shell::GetInstance()->GetContainer( |
107 root_window, ash::internal::kShellWindowId_SettingBubbleContainer)); | 108 root_window, ash::internal::kShellWindowId_SettingBubbleContainer)); |
108 } | 109 } |
109 label_ = new views::Label; | 110 label_ = new views::Label; |
110 label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 111 label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
111 label_->SetEnabledColor(kTooltipTextColor); | 112 label_->SetEnabledColor(kTooltipTextColor); |
112 label_->SetElideBehavior(views::Label::ELIDE_AT_END); | 113 label_->SetElideBehavior(views::Label::ELIDE_AT_END); |
113 AddChildView(label_); | 114 AddChildView(label_); |
114 views::BubbleDelegateView::CreateBubble(this); | 115 views::BubbleDelegateView::CreateBubble(this); |
115 bubble_border_ = new views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT); | 116 bubble_border_ = new views::BubbleBorder2(views::BubbleBorder::BOTTOM_RIGHT); |
116 bubble_border_->SetShadow(gfx::ShadowValue( | 117 bubble_border_->SetShadow(gfx::ShadowValue( |
117 gfx::Point(0, 5), kShadowWidth, SkColorSetARGB(0x72, 0, 0, 0))); | 118 gfx::Point(0, 5), kShadowWidth, SkColorSetARGB(0x72, 0, 0, 0))); |
118 bubble_border_->set_arrow_width(kArrowWidth); | 119 bubble_border_->set_arrow_width(kArrowWidth); |
119 bubble_border_->set_arrow_height(kArrowHeight); | 120 bubble_border_->set_arrow_height(kArrowHeight); |
120 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset, | 121 set_anchor_insets(gfx::Insets(kArrowOffset, kArrowOffset, kArrowOffset, |
121 kArrowOffset)); | 122 kArrowOffset)); |
122 GetBubbleFrameView()->SetBubbleBorder(bubble_border_); | 123 GetBubbleFrameView()->SetBubbleBorder(bubble_border_); |
| 124 |
| 125 // BubbleBorder2 paints its own background. |
| 126 GetBubbleFrameView()->set_background(NULL); |
123 } | 127 } |
124 | 128 |
125 void LauncherTooltipManager::LauncherTooltipBubble::SetText( | 129 void LauncherTooltipManager::LauncherTooltipBubble::SetText( |
126 const string16& text) { | 130 const string16& text) { |
127 label_->SetText(text); | 131 label_->SetText(text); |
128 SizeToContents(); | 132 SizeToContents(); |
129 } | 133 } |
130 | 134 |
131 void LauncherTooltipManager::LauncherTooltipBubble::Close() { | 135 void LauncherTooltipManager::LauncherTooltipBubble::Close() { |
132 if (GetWidget()) { | 136 if (GetWidget()) { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 view_->SetText(text_); | 409 view_->SetText(text_); |
406 | 410 |
407 gfx::NativeView native_view = widget_->GetNativeView(); | 411 gfx::NativeView native_view = widget_->GetNativeView(); |
408 SetWindowVisibilityAnimationType( | 412 SetWindowVisibilityAnimationType( |
409 native_view, WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 413 native_view, WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
410 SetWindowVisibilityAnimationTransition(native_view, ANIMATE_HIDE); | 414 SetWindowVisibilityAnimationTransition(native_view, ANIMATE_HIDE); |
411 } | 415 } |
412 | 416 |
413 } // namespace internal | 417 } // namespace internal |
414 } // namespace ash | 418 } // namespace ash |
OLD | NEW |