| 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 "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/default_style.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/color_utils.h" | 11 #include "ui/gfx/color_utils.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/native_theme/native_theme.h" | 13 #include "ui/native_theme/native_theme.h" |
| 13 #include "ui/views/bubble/bubble_frame_view.h" | 14 #include "ui/views/bubble/bubble_frame_view.h" |
| 14 #include "ui/views/focus/view_storage.h" | 15 #include "ui/views/focus/view_storage.h" |
| 15 #include "ui/views/layout/layout_constants.h" | 16 #include "ui/views/layout/layout_constants.h" |
| 16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 17 #include "ui/views/widget/widget_observer.h" | 18 #include "ui/views/widget/widget_observer.h" |
| 18 | 19 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 gfx::Rect BubbleDelegateView::GetBubbleBounds() { | 295 gfx::Rect BubbleDelegateView::GetBubbleBounds() { |
| 295 // The argument rect has its origin at the bubble's arrow anchor point; | 296 // The argument rect has its origin at the bubble's arrow anchor point; |
| 296 // its size is the preferred size of the bubble's client view (this view). | 297 // its size is the preferred size of the bubble's client view (this view). |
| 297 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); | 298 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); |
| 298 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), | 299 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), |
| 299 GetPreferredSize(), adjust_if_offscreen_ && !anchor_minimized); | 300 GetPreferredSize(), adjust_if_offscreen_ && !anchor_minimized); |
| 300 } | 301 } |
| 301 | 302 |
| 302 const gfx::FontList& BubbleDelegateView::GetTitleFontList() const { | 303 const gfx::FontList& BubbleDelegateView::GetTitleFontList() const { |
| 303 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 304 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 304 return rb.GetFontList(ui::ResourceBundle::MediumFont); | 305 return rb.GetFontListWithDelta(ui::kTitleFontSizeDelta); |
| 305 } | 306 } |
| 306 | 307 |
| 307 | |
| 308 void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) { | 308 void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) { |
| 309 if (!color_explicitly_set_) | 309 if (!color_explicitly_set_) |
| 310 color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); | 310 color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); |
| 311 set_background(Background::CreateSolidBackground(color())); | 311 set_background(Background::CreateSolidBackground(color())); |
| 312 BubbleFrameView* frame_view = GetBubbleFrameView(); | 312 BubbleFrameView* frame_view = GetBubbleFrameView(); |
| 313 if (frame_view) | 313 if (frame_view) |
| 314 frame_view->bubble_border()->set_background_color(color()); | 314 frame_view->bubble_border()->set_background_color(color()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { | 317 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 329 // http://crbug.com/474622 for details. | 329 // http://crbug.com/474622 for details. |
| 330 if (widget == GetWidget() && visible) { | 330 if (widget == GetWidget() && visible) { |
| 331 ui::AXViewState state; | 331 ui::AXViewState state; |
| 332 GetAccessibleState(&state); | 332 GetAccessibleState(&state); |
| 333 if (state.role == ui::AX_ROLE_ALERT_DIALOG) | 333 if (state.role == ui::AX_ROLE_ALERT_DIALOG) |
| 334 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 334 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace views | 338 } // namespace views |
| OLD | NEW |