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.
5 #include "chrome/browser/ui/cocoa/extensions/extension_message_bubble_bridge.h"
7 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
8 #include "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_mac.h"
10 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge(
11 scoped_ptr<extensions::ExtensionMessageBubbleController> controller,
12 bool anchored_to_extension)
13 : controller_(controller.Pass()),
14 anchored_to_extension_(anchored_to_extension),
18 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {
21 void ExtensionMessageBubbleBridge::SetBubble(
22 ToolbarActionsBarBubbleMac* bubble) {
27 void ExtensionMessageBubbleBridge::Show() {
29 [bubble_ showWindow:nil];
32 base::string16 ExtensionMessageBubbleBridge::GetHeadingText() {
33 return controller_->delegate()->GetTitle();
36 base::string16 ExtensionMessageBubbleBridge::GetBodyText() {
37 return controller_->delegate()->GetMessageBody(
38 anchored_to_extension_,
39 controller_->GetExtensionIdList().size());
42 base::string16 ExtensionMessageBubbleBridge::GetItemListText() {
43 return controller_->GetExtensionListForDisplay();
46 base::string16 ExtensionMessageBubbleBridge::GetActionButtonText() {
47 return controller_->delegate()->GetActionButtonLabel();
50 base::string16 ExtensionMessageBubbleBridge::GetDismissButtonText() {
51 return controller_->delegate()->GetDismissButtonLabel();
54 base::string16 ExtensionMessageBubbleBridge::GetLearnMoreButtonText() {
55 return controller_->delegate()->GetLearnMoreLabel();
58 void ExtensionMessageBubbleBridge::OnBubbleShown() {
61 void ExtensionMessageBubbleBridge::OnBubbleClosed(CloseAction action) {
64 controller_->OnBubbleDismiss();
67 controller_->OnBubbleAction();
69 case CLOSE_LEARN_MORE:
70 controller_->OnLinkClicked();