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

Side by Side Diff: chrome/browser/ui/extensions/extension_message_bubble_bridge.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/cocoa/extensions/extension_message_bubble_bridge.h" 5 #include "chrome/browser/ui/extensions/extension_message_bubble_bridge.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
10 #include "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h"
11 10
12 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge( 11 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge(
13 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller, 12 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller)
14 bool anchored_to_extension) 13 : controller_(std::move(controller)) {}
15 : controller_(std::move(controller)),
16 anchored_to_extension_(anchored_to_extension) {}
17 14
18 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() { 15 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {}
16
17 bool ExtensionMessageBubbleBridge::ShouldShow() {
18 return controller_->ShouldShow();
19 }
20
21 bool ExtensionMessageBubbleBridge::ShouldCloseOnDeactivate() {
22 return controller_->CloseOnDeactivate();
19 } 23 }
20 24
21 base::string16 ExtensionMessageBubbleBridge::GetHeadingText() { 25 base::string16 ExtensionMessageBubbleBridge::GetHeadingText() {
22 return controller_->delegate()->GetTitle(); 26 return controller_->delegate()->GetTitle();
23 } 27 }
24 28
25 base::string16 ExtensionMessageBubbleBridge::GetBodyText() { 29 base::string16 ExtensionMessageBubbleBridge::GetBodyText(
30 bool anchored_to_action) {
26 return controller_->delegate()->GetMessageBody( 31 return controller_->delegate()->GetMessageBody(
27 anchored_to_extension_, 32 anchored_to_action, controller_->GetExtensionIdList().size());
28 controller_->GetExtensionIdList().size());
29 } 33 }
30 34
31 base::string16 ExtensionMessageBubbleBridge::GetItemListText() { 35 base::string16 ExtensionMessageBubbleBridge::GetItemListText() {
32 return controller_->GetExtensionListForDisplay(); 36 return controller_->GetExtensionListForDisplay();
33 } 37 }
34 38
35 base::string16 ExtensionMessageBubbleBridge::GetActionButtonText() { 39 base::string16 ExtensionMessageBubbleBridge::GetActionButtonText() {
36 return controller_->delegate()->GetActionButtonLabel(); 40 return controller_->delegate()->GetActionButtonLabel();
37 } 41 }
38 42
39 base::string16 ExtensionMessageBubbleBridge::GetDismissButtonText() { 43 base::string16 ExtensionMessageBubbleBridge::GetDismissButtonText() {
40 return controller_->delegate()->GetDismissButtonLabel(); 44 return controller_->delegate()->GetDismissButtonLabel();
41 } 45 }
42 46
43 base::string16 ExtensionMessageBubbleBridge::GetLearnMoreButtonText() { 47 base::string16 ExtensionMessageBubbleBridge::GetLearnMoreButtonText() {
44 return controller_->delegate()->GetLearnMoreLabel(); 48 return controller_->delegate()->GetLearnMoreLabel();
45 } 49 }
46 50
47 std::string ExtensionMessageBubbleBridge::GetAnchorActionId() { 51 std::string ExtensionMessageBubbleBridge::GetAnchorActionId() {
48 return controller_->GetExtensionIdList().size() == 1u ? 52 return controller_->GetExtensionIdList().size() == 1u
49 controller_->GetExtensionIdList()[0] : std::string(); 53 ? controller_->GetExtensionIdList()[0]
54 : std::string();
50 } 55 }
51 56
52 void ExtensionMessageBubbleBridge::OnBubbleShown() { 57 void ExtensionMessageBubbleBridge::OnBubbleShown() {}
53 }
54 58
55 void ExtensionMessageBubbleBridge::OnBubbleClosed(CloseAction action) { 59 void ExtensionMessageBubbleBridge::OnBubbleClosed(CloseAction action) {
56 switch(action) { 60 switch (action) {
57 case CLOSE_DISMISS_USER_ACTION: 61 case CLOSE_DISMISS_USER_ACTION:
58 case CLOSE_DISMISS_DEACTIVATION: { 62 case CLOSE_DISMISS_DEACTIVATION: {
59 bool close_by_deactivate = action == CLOSE_DISMISS_DEACTIVATION; 63 bool close_by_deactivate = action == CLOSE_DISMISS_DEACTIVATION;
60 controller_->OnBubbleDismiss(close_by_deactivate); 64 controller_->OnBubbleDismiss(close_by_deactivate);
61 break; 65 break;
62 } 66 }
63 case CLOSE_EXECUTE: 67 case CLOSE_EXECUTE:
64 controller_->OnBubbleAction(); 68 controller_->OnBubbleAction();
65 break; 69 break;
66 case CLOSE_LEARN_MORE: 70 case CLOSE_LEARN_MORE:
67 controller_->OnLinkClicked(); 71 controller_->OnLinkClicked();
68 break; 72 break;
69 } 73 }
70 } 74 }
75
76 bool ExtensionMessageBubbleBridge::IsExtensionMessageBubble() {
77 return true;
78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698