| 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/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Detects any mouse movement. This is needed to detect mouse movements by the | 51 // Detects any mouse movement. This is needed to detect mouse movements by the |
| 52 // user over the bubble if the bubble got created underneath the cursor. | 52 // user over the bubble if the bubble got created underneath the cursor. |
| 53 class MouseMoveDetectorHost : public MouseWatcherHost { | 53 class MouseMoveDetectorHost : public MouseWatcherHost { |
| 54 public: | 54 public: |
| 55 MouseMoveDetectorHost(); | 55 MouseMoveDetectorHost(); |
| 56 virtual ~MouseMoveDetectorHost(); | 56 virtual ~MouseMoveDetectorHost(); |
| 57 | 57 |
| 58 virtual bool Contains(const gfx::Point& screen_point, | 58 virtual bool Contains(const gfx::Point& screen_point, |
| 59 MouseEventType type) OVERRIDE; | 59 MouseEventType type) OVERRIDE; |
| 60 private: | 60 private: |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost); | 61 DISALLOW_COPY_AND_ASSIGN(MouseMoveDetectorHost); |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 MouseMoveDetectorHost::MouseMoveDetectorHost() { | 64 MouseMoveDetectorHost::MouseMoveDetectorHost() { |
| 66 } | 65 } |
| 67 | 66 |
| 68 MouseMoveDetectorHost::~MouseMoveDetectorHost() { | 67 MouseMoveDetectorHost::~MouseMoveDetectorHost() { |
| 69 } | 68 } |
| 70 | 69 |
| 71 bool MouseMoveDetectorHost::Contains(const gfx::Point& screen_point, | 70 bool MouseMoveDetectorHost::Contains(const gfx::Point& screen_point, |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 if (preferred_width_ == width) | 374 if (preferred_width_ == width) |
| 376 return; | 375 return; |
| 377 preferred_width_ = width; | 376 preferred_width_ = width; |
| 378 if (GetWidget()) | 377 if (GetWidget()) |
| 379 SizeToContents(); | 378 SizeToContents(); |
| 380 } | 379 } |
| 381 | 380 |
| 382 void TrayBubbleView::SetArrowPaintType( | 381 void TrayBubbleView::SetArrowPaintType( |
| 383 views::BubbleBorder::ArrowPaintType paint_type) { | 382 views::BubbleBorder::ArrowPaintType paint_type) { |
| 384 bubble_border_->set_paint_arrow(paint_type); | 383 bubble_border_->set_paint_arrow(paint_type); |
| 384 UpdateBubble(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 gfx::Insets TrayBubbleView::GetBorderInsets() const { | 387 gfx::Insets TrayBubbleView::GetBorderInsets() const { |
| 388 return bubble_border_->GetInsets(); | 388 return bubble_border_->GetInsets(); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void TrayBubbleView::Init() { | 391 void TrayBubbleView::Init() { |
| 392 BoxLayout* layout = new BottomAlignedBoxLayout(this); | 392 BoxLayout* layout = new BottomAlignedBoxLayout(this); |
| 393 layout->SetDefaultFlex(1); | 393 layout->SetDefaultFlex(1); |
| 394 SetLayoutManager(layout); | 394 SetLayoutManager(layout); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 void TrayBubbleView::ViewHierarchyChanged( | 501 void TrayBubbleView::ViewHierarchyChanged( |
| 502 const ViewHierarchyChangedDetails& details) { | 502 const ViewHierarchyChangedDetails& details) { |
| 503 if (details.is_add && details.child == this) { | 503 if (details.is_add && details.child == this) { |
| 504 details.parent->SetPaintToLayer(true); | 504 details.parent->SetPaintToLayer(true); |
| 505 details.parent->SetFillsBoundsOpaquely(true); | 505 details.parent->SetFillsBoundsOpaquely(true); |
| 506 details.parent->layer()->SetMasksToBounds(true); | 506 details.parent->layer()->SetMasksToBounds(true); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace views | 510 } // namespace views |
| OLD | NEW |