| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const { | 266 BubbleFrameView* BubbleDelegateView::GetBubbleFrameView() const { |
| 267 const NonClientView* view = | 267 const NonClientView* view = |
| 268 GetWidget() ? GetWidget()->non_client_view() : NULL; | 268 GetWidget() ? GetWidget()->non_client_view() : NULL; |
| 269 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; | 269 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; |
| 270 } | 270 } |
| 271 | 271 |
| 272 gfx::Rect BubbleDelegateView::GetBubbleBounds() { | 272 gfx::Rect BubbleDelegateView::GetBubbleBounds() { |
| 273 // The argument rect has its origin at the bubble's arrow anchor point; | 273 // The argument rect has its origin at the bubble's arrow anchor point; |
| 274 // its size is the preferred size of the bubble's client view (this view). | 274 // its size is the preferred size of the bubble's client view (this view). |
| 275 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); |
| 275 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), | 276 return GetBubbleFrameView()->GetUpdatedWindowBounds(GetAnchorRect(), |
| 276 GetPreferredSize(), adjust_if_offscreen_); | 277 GetPreferredSize(), adjust_if_offscreen_ && !anchor_minimized); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) { | 280 void BubbleDelegateView::UpdateColorsFromTheme(const ui::NativeTheme* theme) { |
| 280 if (!color_explicitly_set_) | 281 if (!color_explicitly_set_) |
| 281 color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); | 282 color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); |
| 282 set_background(Background::CreateSolidBackground(color())); | 283 set_background(Background::CreateSolidBackground(color())); |
| 283 BubbleFrameView* frame_view = GetBubbleFrameView(); | 284 BubbleFrameView* frame_view = GetBubbleFrameView(); |
| 284 if (frame_view) | 285 if (frame_view) |
| 285 frame_view->bubble_border()->set_background_color(color()); | 286 frame_view->bubble_border()->set_background_color(color()); |
| 286 } | 287 } |
| 287 | 288 |
| 288 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { | 289 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { |
| 289 if (widget == GetWidget() && anchor_widget() && | 290 if (widget == GetWidget() && anchor_widget() && |
| 290 anchor_widget()->GetTopLevelWidget()) { | 291 anchor_widget()->GetTopLevelWidget()) { |
| 291 if (visible) | 292 if (visible) |
| 292 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); | 293 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); |
| 293 else | 294 else |
| 294 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); | 295 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); |
| 295 } | 296 } |
| 296 } | 297 } |
| 297 | 298 |
| 298 } // namespace views | 299 } // namespace views |
| OLD | NEW |