| 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/base/animation/slide_animation.h" | 7 #include "ui/base/animation/slide_animation.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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 bubble_->GetWidget()->AddObserver(this); | 59 bubble_->GetWidget()->AddObserver(this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual ~BubbleBorderDelegate() { | 62 virtual ~BubbleBorderDelegate() { |
| 63 if (bubble_ && bubble_->GetWidget()) | 63 if (bubble_ && bubble_->GetWidget()) |
| 64 bubble_->GetWidget()->RemoveObserver(this); | 64 bubble_->GetWidget()->RemoveObserver(this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // WidgetDelegate overrides: | 67 // WidgetDelegate overrides: |
| 68 virtual bool CanActivate() const OVERRIDE { return false; } | 68 virtual bool CanActivate() const OVERRIDE { return false; } |
| 69 virtual string16 GetWindowTitle() const { |
| 70 return bubble_->GetWindowTitle(); |
| 71 } |
| 72 virtual bool ShouldShowCloseButton() const OVERRIDE { |
| 73 return bubble_->ShouldShowCloseButton(); |
| 74 } |
| 69 virtual void DeleteDelegate() OVERRIDE { delete this; } | 75 virtual void DeleteDelegate() OVERRIDE { delete this; } |
| 70 virtual Widget* GetWidget() OVERRIDE { return widget_; } | 76 virtual Widget* GetWidget() OVERRIDE { return widget_; } |
| 71 virtual const Widget* GetWidget() const OVERRIDE { return widget_; } | 77 virtual const Widget* GetWidget() const OVERRIDE { return widget_; } |
| 72 virtual NonClientFrameView* CreateNonClientFrameView( | 78 virtual NonClientFrameView* CreateNonClientFrameView( |
| 73 Widget* widget) OVERRIDE { | 79 Widget* widget) OVERRIDE { |
| 74 return bubble_->CreateNonClientFrameView(widget); | 80 return bubble_->CreateNonClientFrameView(widget); |
| 75 } | 81 } |
| 76 | 82 |
| 77 // WidgetObserver overrides: | 83 // WidgetObserver overrides: |
| 78 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE { | 84 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 } | 191 } |
| 186 | 192 |
| 187 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { | 193 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { |
| 188 return this; | 194 return this; |
| 189 } | 195 } |
| 190 | 196 |
| 191 bool BubbleDelegateView::CanActivate() const { | 197 bool BubbleDelegateView::CanActivate() const { |
| 192 return !use_focusless(); | 198 return !use_focusless(); |
| 193 } | 199 } |
| 194 | 200 |
| 201 bool BubbleDelegateView::ShouldShowCloseButton() const { |
| 202 return false; |
| 203 } |
| 204 |
| 195 View* BubbleDelegateView::GetContentsView() { | 205 View* BubbleDelegateView::GetContentsView() { |
| 196 return this; | 206 return this; |
| 197 } | 207 } |
| 198 | 208 |
| 199 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( | 209 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( |
| 200 Widget* widget) { | 210 Widget* widget) { |
| 201 BubbleFrameView* frame = new BubbleFrameView(margins()); | 211 BubbleFrameView* frame = new BubbleFrameView(margins()); |
| 202 const BubbleBorder::Arrow adjusted_arrow = base::i18n::IsRTL() ? | 212 const BubbleBorder::Arrow adjusted_arrow = base::i18n::IsRTL() ? |
| 203 BubbleBorder::horizontal_mirror(arrow()) : arrow(); | 213 BubbleBorder::horizontal_mirror(arrow()) : arrow(); |
| 204 frame->SetBubbleBorder(new BubbleBorder(adjusted_arrow, shadow(), color())); | 214 frame->SetBubbleBorder(new BubbleBorder(adjusted_arrow, shadow(), color())); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 #if defined(OS_WIN) && !defined(USE_AURA) | 399 #if defined(OS_WIN) && !defined(USE_AURA) |
| 390 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 400 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
| 391 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 401 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
| 392 client_bounds.Offset( | 402 client_bounds.Offset( |
| 393 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); | 403 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); |
| 394 return client_bounds; | 404 return client_bounds; |
| 395 } | 405 } |
| 396 #endif | 406 #endif |
| 397 | 407 |
| 398 } // namespace views | 408 } // namespace views |
| OLD | NEW |