| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h" | 5 #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 | 9 |
| 10 class TestToolbarActionsBarBubbleDelegate::DelegateImpl | 10 class TestToolbarActionsBarBubbleDelegate::DelegateImpl |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 std::string GetAnchorActionId() override { return std::string(); } | 32 std::string GetAnchorActionId() override { return std::string(); } |
| 33 void OnBubbleShown() override { | 33 void OnBubbleShown() override { |
| 34 CHECK(!parent_->shown_); | 34 CHECK(!parent_->shown_); |
| 35 parent_->shown_ = true; | 35 parent_->shown_ = true; |
| 36 } | 36 } |
| 37 void OnBubbleClosed(CloseAction action) override { | 37 void OnBubbleClosed(CloseAction action) override { |
| 38 CHECK(!parent_->close_action_); | 38 CHECK(!parent_->close_action_); |
| 39 parent_->close_action_.reset(new CloseAction(action)); | 39 parent_->close_action_.reset(new CloseAction(action)); |
| 40 } | 40 } |
| 41 bool IsExtensionMessageBubble() override { return false; } | |
| 42 | 41 |
| 43 TestToolbarActionsBarBubbleDelegate* parent_; | 42 TestToolbarActionsBarBubbleDelegate* parent_; |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(DelegateImpl); | 44 DISALLOW_COPY_AND_ASSIGN(DelegateImpl); |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 TestToolbarActionsBarBubbleDelegate::TestToolbarActionsBarBubbleDelegate( | 47 TestToolbarActionsBarBubbleDelegate::TestToolbarActionsBarBubbleDelegate( |
| 49 const base::string16& heading, | 48 const base::string16& heading, |
| 50 const base::string16& body, | 49 const base::string16& body, |
| 51 const base::string16& action) | 50 const base::string16& action) |
| 52 : shown_(false), | 51 : shown_(false), |
| 53 heading_(heading), | 52 heading_(heading), |
| 54 body_(body), | 53 body_(body), |
| 55 action_(action), | 54 action_(action), |
| 56 close_on_deactivate_(true) { | 55 close_on_deactivate_(true) { |
| 57 } | 56 } |
| 58 | 57 |
| 59 TestToolbarActionsBarBubbleDelegate::~TestToolbarActionsBarBubbleDelegate() { | 58 TestToolbarActionsBarBubbleDelegate::~TestToolbarActionsBarBubbleDelegate() { |
| 60 // If the bubble didn't close, it means that it still owns the DelegateImpl, | 59 // If the bubble didn't close, it means that it still owns the DelegateImpl, |
| 61 // which has a weak ptr to this object. Make sure that this class always | 60 // which has a weak ptr to this object. Make sure that this class always |
| 62 // outlives the bubble. | 61 // outlives the bubble. |
| 63 CHECK(close_action_); | 62 CHECK(close_action_); |
| 64 } | 63 } |
| 65 | 64 |
| 66 std::unique_ptr<ToolbarActionsBarBubbleDelegate> | 65 std::unique_ptr<ToolbarActionsBarBubbleDelegate> |
| 67 TestToolbarActionsBarBubbleDelegate::GetDelegate() { | 66 TestToolbarActionsBarBubbleDelegate::GetDelegate() { |
| 68 return std::unique_ptr<ToolbarActionsBarBubbleDelegate>( | 67 return std::unique_ptr<ToolbarActionsBarBubbleDelegate>( |
| 69 new DelegateImpl(this)); | 68 new DelegateImpl(this)); |
| 70 } | 69 } |
| OLD | NEW |