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 "ui/views/bubble/bubble_delegate.h" | 5 #include "ui/views/bubble/bubble_delegate.h" |
6 | 6 |
7 #include "ui/accessibility/ax_view_state.h" | 7 #include "ui/accessibility/ax_view_state.h" |
8 #include "ui/gfx/color_utils.h" | 8 #include "ui/gfx/color_utils.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/native_theme/native_theme.h" | 10 #include "ui/native_theme/native_theme.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 View* BubbleDelegateView::GetContentsView() { | 127 View* BubbleDelegateView::GetContentsView() { |
128 return this; | 128 return this; |
129 } | 129 } |
130 | 130 |
131 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( | 131 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( |
132 Widget* widget) { | 132 Widget* widget) { |
133 BubbleFrameView* frame = new BubbleFrameView(margins()); | 133 BubbleFrameView* frame = new BubbleFrameView(margins()); |
| 134 if (ShouldShowWindowTitleInBaseFont()) |
| 135 frame->ShowTitleInBaseFont(); |
134 BubbleBorder::Arrow adjusted_arrow = arrow(); | 136 BubbleBorder::Arrow adjusted_arrow = arrow(); |
135 if (base::i18n::IsRTL()) | 137 if (base::i18n::IsRTL()) |
136 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); | 138 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); |
137 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>( | 139 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>( |
138 new BubbleBorder(adjusted_arrow, shadow(), color()))); | 140 new BubbleBorder(adjusted_arrow, shadow(), color()))); |
139 return frame; | 141 return frame; |
140 } | 142 } |
141 | 143 |
142 void BubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { | 144 void BubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { |
143 state->role = ui::AX_ROLE_DIALOG; | 145 state->role = ui::AX_ROLE_DIALOG; |
(...skipping 26 matching lines...) Expand all Loading... |
170 if (close_on_deactivate() && widget == GetWidget() && !active) | 172 if (close_on_deactivate() && widget == GetWidget() && !active) |
171 GetWidget()->Close(); | 173 GetWidget()->Close(); |
172 } | 174 } |
173 | 175 |
174 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, | 176 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, |
175 const gfx::Rect& new_bounds) { | 177 const gfx::Rect& new_bounds) { |
176 if (anchor_widget() == widget) | 178 if (anchor_widget() == widget) |
177 SizeToContents(); | 179 SizeToContents(); |
178 } | 180 } |
179 | 181 |
| 182 bool BubbleDelegateView::ShouldShowWindowTitleInBaseFont() const { |
| 183 return false; |
| 184 } |
| 185 |
180 View* BubbleDelegateView::GetAnchorView() const { | 186 View* BubbleDelegateView::GetAnchorView() const { |
181 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_); | 187 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_); |
182 } | 188 } |
183 | 189 |
184 gfx::Rect BubbleDelegateView::GetAnchorRect() const { | 190 gfx::Rect BubbleDelegateView::GetAnchorRect() const { |
185 if (!GetAnchorView()) | 191 if (!GetAnchorView()) |
186 return anchor_rect_; | 192 return anchor_rect_; |
187 | 193 |
188 anchor_rect_ = GetAnchorView()->GetBoundsInScreen(); | 194 anchor_rect_ = GetAnchorView()->GetBoundsInScreen(); |
189 anchor_rect_.Inset(anchor_view_insets_); | 195 anchor_rect_.Inset(anchor_view_insets_); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (widget == GetWidget() && anchor_widget() && | 295 if (widget == GetWidget() && anchor_widget() && |
290 anchor_widget()->GetTopLevelWidget()) { | 296 anchor_widget()->GetTopLevelWidget()) { |
291 if (visible) | 297 if (visible) |
292 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); | 298 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); |
293 else | 299 else |
294 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); | 300 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); |
295 } | 301 } |
296 } | 302 } |
297 | 303 |
298 } // namespace views | 304 } // namespace views |
OLD | NEW |