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

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

Issue 1086973004: [Extensions Mac] Implement developer mode warning on mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h"
6
7 #include "base/logging.h"
8
9 class TestToolbarActionsBarBubbleDelegate::DelegateImpl
10 : public ToolbarActionsBarBubbleDelegate {
11 public:
12 explicit DelegateImpl(TestToolbarActionsBarBubbleDelegate* parent)
13 : parent_(parent) {}
14 ~DelegateImpl() override {}
15
16 private:
17 base::string16 GetHeadingText() override { return parent_->heading_; }
18 base::string16 GetBodyText() override { return parent_->body_; }
19 base::string16 GetActionButtonText() override { return parent_->action_; }
20 base::string16 GetDismissButtonText() override { return parent_->dismiss_; }
21 base::string16 GetLearnMoreButtonText() override {
22 return parent_->learn_more_;
23 }
24 void OnBubbleShown() override {
25 CHECK(!parent_->shown_);
26 parent_->shown_ = true;
27 }
28 void OnBubbleClosed(CloseAction action) override {
29 CHECK(!parent_->close_action_);
30 parent_->close_action_.reset(new CloseAction(action));
31 }
32
33 TestToolbarActionsBarBubbleDelegate* parent_;
34
35 DISALLOW_COPY_AND_ASSIGN(DelegateImpl);
36 };
37
38 TestToolbarActionsBarBubbleDelegate::TestToolbarActionsBarBubbleDelegate(
39 const base::string16& heading,
40 const base::string16& body,
41 const base::string16& action)
42 : shown_(false),
43 heading_(heading),
44 body_(body),
45 action_(action) {
46 }
47
48 TestToolbarActionsBarBubbleDelegate::~TestToolbarActionsBarBubbleDelegate() {
49 // If the bubble didn't close, it means that it still owns the DelegateImpl,
50 // which has a weak ptr to this object. Make sure that this class always
51 // outlives the bubble.
52 CHECK(close_action_);
53 }
54
55 scoped_ptr<ToolbarActionsBarBubbleDelegate>
56 TestToolbarActionsBarBubbleDelegate::GetDelegate() {
57 return scoped_ptr<ToolbarActionsBarBubbleDelegate>(new DelegateImpl(this));
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698