| 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 |
| 11 : public ToolbarActionsBarBubbleDelegate { | 11 : public ToolbarActionsBarBubbleDelegate { |
| 12 public: | 12 public: |
| 13 explicit DelegateImpl(TestToolbarActionsBarBubbleDelegate* parent) | 13 explicit DelegateImpl(TestToolbarActionsBarBubbleDelegate* parent) |
| 14 : parent_(parent) {} | 14 : parent_(parent) {} |
| 15 ~DelegateImpl() override {} | 15 ~DelegateImpl() override {} |
| 16 | 16 |
| 17 private: | 17 private: |
| 18 base::string16 GetHeadingText() override { return parent_->heading_; } | 18 base::string16 GetHeadingText() override { return parent_->heading_; } |
| 19 base::string16 GetBodyText() override { return parent_->body_; } | 19 base::string16 GetBodyText() override { return parent_->body_; } |
| 20 base::string16 GetItemListText() override { return parent_->item_list_; } | 20 base::string16 GetItemListText() override { return parent_->item_list_; } |
| 21 base::string16 GetActionButtonText() override { return parent_->action_; } | 21 base::string16 GetActionButtonText() override { return parent_->action_; } |
| 22 base::string16 GetDismissButtonText() override { return parent_->dismiss_; } | 22 base::string16 GetDismissButtonText() override { return parent_->dismiss_; } |
| 23 base::string16 GetLearnMoreButtonText() override { | 23 base::string16 GetLearnMoreButtonText() override { |
| 24 return parent_->learn_more_; | 24 return parent_->learn_more_; |
| 25 } | 25 } |
| 26 std::string GetAnchorActionId() override { return std::string(); } |
| 26 void OnBubbleShown() override { | 27 void OnBubbleShown() override { |
| 27 CHECK(!parent_->shown_); | 28 CHECK(!parent_->shown_); |
| 28 parent_->shown_ = true; | 29 parent_->shown_ = true; |
| 29 } | 30 } |
| 30 void OnBubbleClosed(CloseAction action) override { | 31 void OnBubbleClosed(CloseAction action) override { |
| 31 CHECK(!parent_->close_action_); | 32 CHECK(!parent_->close_action_); |
| 32 parent_->close_action_.reset(new CloseAction(action)); | 33 parent_->close_action_.reset(new CloseAction(action)); |
| 33 } | 34 } |
| 34 | 35 |
| 35 TestToolbarActionsBarBubbleDelegate* parent_; | 36 TestToolbarActionsBarBubbleDelegate* parent_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 51 // If the bubble didn't close, it means that it still owns the DelegateImpl, | 52 // If the bubble didn't close, it means that it still owns the DelegateImpl, |
| 52 // which has a weak ptr to this object. Make sure that this class always | 53 // which has a weak ptr to this object. Make sure that this class always |
| 53 // outlives the bubble. | 54 // outlives the bubble. |
| 54 CHECK(close_action_); | 55 CHECK(close_action_); |
| 55 } | 56 } |
| 56 | 57 |
| 57 scoped_ptr<ToolbarActionsBarBubbleDelegate> | 58 scoped_ptr<ToolbarActionsBarBubbleDelegate> |
| 58 TestToolbarActionsBarBubbleDelegate::GetDelegate() { | 59 TestToolbarActionsBarBubbleDelegate::GetDelegate() { |
| 59 return scoped_ptr<ToolbarActionsBarBubbleDelegate>(new DelegateImpl(this)); | 60 return scoped_ptr<ToolbarActionsBarBubbleDelegate>(new DelegateImpl(this)); |
| 60 } | 61 } |
| OLD | NEW |