OLD | NEW |
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/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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 anchored_to_action, controller_->GetExtensionIdList().size()); | 45 anchored_to_action, controller_->GetExtensionIdList().size()); |
46 } | 46 } |
47 | 47 |
48 base::string16 ExtensionMessageBubbleBridge::GetItemListText() { | 48 base::string16 ExtensionMessageBubbleBridge::GetItemListText() { |
49 return controller_->GetExtensionListForDisplay(); | 49 return controller_->GetExtensionListForDisplay(); |
50 } | 50 } |
51 | 51 |
52 base::string16 ExtensionMessageBubbleBridge::GetActionButtonText() { | 52 base::string16 ExtensionMessageBubbleBridge::GetActionButtonText() { |
53 const extensions::ExtensionIdList& list = controller_->GetExtensionIdList(); | 53 const extensions::ExtensionIdList& list = controller_->GetExtensionIdList(); |
54 DCHECK(!list.empty()); | 54 DCHECK(!list.empty()); |
| 55 // Normally, the extension is enabled, but this might not be the case (such as |
| 56 // for the SuspiciousExtensionBubbleDelegate, which warns the user about |
| 57 // disabled extensions). |
55 const extensions::Extension* extension = | 58 const extensions::Extension* extension = |
56 extensions::ExtensionRegistry::Get(controller_->profile()) | 59 extensions::ExtensionRegistry::Get(controller_->profile()) |
57 ->enabled_extensions() | 60 ->GetExtensionById(list[0], |
58 .GetByID(list[0]); | 61 extensions::ExtensionRegistry::EVERYTHING); |
59 | 62 |
60 DCHECK(extension); | 63 DCHECK(extension); |
61 // An empty string is returned so that we don't display the button prompting | 64 // An empty string is returned so that we don't display the button prompting |
62 // to remove policy-installed extensions. | 65 // to remove policy-installed extensions. |
63 if (IsPolicyIndicationNeeded(extension)) | 66 if (IsPolicyIndicationNeeded(extension)) |
64 return base::string16(); | 67 return base::string16(); |
65 return controller_->delegate()->GetActionButtonLabel(); | 68 return controller_->delegate()->GetActionButtonLabel(); |
66 } | 69 } |
67 | 70 |
68 base::string16 ExtensionMessageBubbleBridge::GetDismissButtonText() { | 71 base::string16 ExtensionMessageBubbleBridge::GetDismissButtonText() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 extra_view_info->text = | 124 extra_view_info->text = |
122 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN); | 125 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN); |
123 extra_view_info->is_text_linked = false; | 126 extra_view_info->is_text_linked = false; |
124 } else { | 127 } else { |
125 extra_view_info->text = controller_->delegate()->GetLearnMoreLabel(); | 128 extra_view_info->text = controller_->delegate()->GetLearnMoreLabel(); |
126 extra_view_info->is_text_linked = true; | 129 extra_view_info->is_text_linked = true; |
127 } | 130 } |
128 | 131 |
129 return extra_view_info; | 132 return extra_view_info; |
130 } | 133 } |
OLD | NEW |