Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.cc

Issue 1858773006: [Extensions UI] Use the ExtensionMessageBubbleBridge for Views platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 bool ShouldShow() override { return true; }
19 bool ShouldCloseOnDeactivate() override {
20 return parent_->close_on_deactivate_;
21 }
18 base::string16 GetHeadingText() override { return parent_->heading_; } 22 base::string16 GetHeadingText() override { return parent_->heading_; }
19 base::string16 GetBodyText() override { return parent_->body_; } 23 base::string16 GetBodyText(bool anchored_to_action) override {
24 return parent_->body_;
25 }
20 base::string16 GetItemListText() override { return parent_->item_list_; } 26 base::string16 GetItemListText() override { return parent_->item_list_; }
21 base::string16 GetActionButtonText() override { return parent_->action_; } 27 base::string16 GetActionButtonText() override { return parent_->action_; }
22 base::string16 GetDismissButtonText() override { return parent_->dismiss_; } 28 base::string16 GetDismissButtonText() override { return parent_->dismiss_; }
23 base::string16 GetLearnMoreButtonText() override { 29 base::string16 GetLearnMoreButtonText() override {
24 return parent_->learn_more_; 30 return parent_->learn_more_;
25 } 31 }
26 std::string GetAnchorActionId() override { return std::string(); } 32 std::string GetAnchorActionId() override { return std::string(); }
27 void OnBubbleShown() override { 33 void OnBubbleShown() override {
28 CHECK(!parent_->shown_); 34 CHECK(!parent_->shown_);
29 parent_->shown_ = true; 35 parent_->shown_ = true;
30 } 36 }
31 void OnBubbleClosed(CloseAction action) override { 37 void OnBubbleClosed(CloseAction action) override {
32 CHECK(!parent_->close_action_); 38 CHECK(!parent_->close_action_);
33 parent_->close_action_.reset(new CloseAction(action)); 39 parent_->close_action_.reset(new CloseAction(action));
34 } 40 }
41 bool IsExtensionMessageBubble() override { return false; }
35 42
36 TestToolbarActionsBarBubbleDelegate* parent_; 43 TestToolbarActionsBarBubbleDelegate* parent_;
37 44
38 DISALLOW_COPY_AND_ASSIGN(DelegateImpl); 45 DISALLOW_COPY_AND_ASSIGN(DelegateImpl);
39 }; 46 };
40 47
41 TestToolbarActionsBarBubbleDelegate::TestToolbarActionsBarBubbleDelegate( 48 TestToolbarActionsBarBubbleDelegate::TestToolbarActionsBarBubbleDelegate(
42 const base::string16& heading, 49 const base::string16& heading,
43 const base::string16& body, 50 const base::string16& body,
44 const base::string16& action) 51 const base::string16& action)
45 : shown_(false), 52 : shown_(false),
46 heading_(heading), 53 heading_(heading),
47 body_(body), 54 body_(body),
48 action_(action) { 55 action_(action),
56 close_on_deactivate_(true) {
49 } 57 }
50 58
51 TestToolbarActionsBarBubbleDelegate::~TestToolbarActionsBarBubbleDelegate() { 59 TestToolbarActionsBarBubbleDelegate::~TestToolbarActionsBarBubbleDelegate() {
52 // If the bubble didn't close, it means that it still owns the DelegateImpl, 60 // If the bubble didn't close, it means that it still owns the DelegateImpl,
53 // which has a weak ptr to this object. Make sure that this class always 61 // which has a weak ptr to this object. Make sure that this class always
54 // outlives the bubble. 62 // outlives the bubble.
55 CHECK(close_action_); 63 CHECK(close_action_);
56 } 64 }
57 65
58 std::unique_ptr<ToolbarActionsBarBubbleDelegate> 66 std::unique_ptr<ToolbarActionsBarBubbleDelegate>
59 TestToolbarActionsBarBubbleDelegate::GetDelegate() { 67 TestToolbarActionsBarBubbleDelegate::GetDelegate() {
60 return std::unique_ptr<ToolbarActionsBarBubbleDelegate>( 68 return std::unique_ptr<ToolbarActionsBarBubbleDelegate>(
61 new DelegateImpl(this)); 69 new DelegateImpl(this));
62 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698