BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / extensions / extension_message_bubble_bridge.mm
blob137a5f7c1b2bbed9e49b40d73551b54f9412fb6d
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),
15       bubble_(nil) {
18 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {
21 void ExtensionMessageBubbleBridge::SetBubble(
22     ToolbarActionsBarBubbleMac* bubble) {
23   DCHECK(!bubble_);
24   bubble_ = bubble;
27 void ExtensionMessageBubbleBridge::Show() {
28   DCHECK(bubble_);
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) {
62   switch(action) {
63     case CLOSE_DISMISS:
64       controller_->OnBubbleDismiss();
65       break;
66     case CLOSE_EXECUTE:
67       controller_->OnBubbleAction();
68       break;
69     case CLOSE_LEARN_MORE:
70       controller_->OnLinkClicked();
71       break;
72   }