| 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_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 503 |
| 504 using BubbleDialogDelegateView::SetAnchorView; | 504 using BubbleDialogDelegateView::SetAnchorView; |
| 505 | 505 |
| 506 void set_override_snap(bool value) { override_snap_ = value; } | 506 void set_override_snap(bool value) { override_snap_ = value; } |
| 507 | 507 |
| 508 // BubbleDialogDelegateView: | 508 // BubbleDialogDelegateView: |
| 509 void DeleteDelegate() override { | 509 void DeleteDelegate() override { |
| 510 // This delegate is owned by the test case itself, so it should not delete | 510 // This delegate is owned by the test case itself, so it should not delete |
| 511 // itself here. | 511 // itself here. |
| 512 } | 512 } |
| 513 int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; } | 513 int GetDialogButtons() const override { return ui::DIALOG_BUTTON_OK; } |
| 514 bool ShouldSnapFrameWidth() const override { | 514 bool ShouldSnapFrameWidth() const override { |
| 515 return override_snap_.value_or( | 515 return override_snap_.value_or( |
| 516 BubbleDialogDelegateView::ShouldSnapFrameWidth()); | 516 BubbleDialogDelegateView::ShouldSnapFrameWidth()); |
| 517 } | 517 } |
| 518 gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); } | 518 gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); } |
| 519 | 519 |
| 520 private: | 520 private: |
| 521 base::Optional<bool> override_snap_; | 521 base::Optional<bool> override_snap_; |
| 522 | 522 |
| 523 DISALLOW_COPY_AND_ASSIGN(TestBubbleDialogDelegateView); | 523 DISALLOW_COPY_AND_ASSIGN(TestBubbleDialogDelegateView); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // If the DialogDelegate asks not to snap, it should not snap. | 559 // If the DialogDelegate asks not to snap, it should not snap. |
| 560 delegate.set_override_snap(false); | 560 delegate.set_override_snap(false); |
| 561 Widget* w2 = BubbleDialogDelegateView::CreateBubble(&delegate); | 561 Widget* w2 = BubbleDialogDelegateView::CreateBubble(&delegate); |
| 562 w2->Show(); | 562 w2->Show(); |
| 563 EXPECT_EQ(delegate.GetPreferredSize().width(), | 563 EXPECT_EQ(delegate.GetPreferredSize().width(), |
| 564 w2->GetWindowBoundsInScreen().width()); | 564 w2->GetWindowBoundsInScreen().width()); |
| 565 w2->CloseNow(); | 565 w2->CloseNow(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace views | 568 } // namespace views |
| OLD | NEW |