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