Chromium Code Reviews| Index: chrome/browser/ui/extensions/extension_message_bubble_bridge.cc |
| diff --git a/chrome/browser/ui/extensions/extension_message_bubble_bridge.cc b/chrome/browser/ui/extensions/extension_message_bubble_bridge.cc |
| index 0611f3269d583a1a51f63197a16a0cf12b245a94..3d295c53f91d08ea9d525c3324bad5412845c7ad 100644 |
| --- a/chrome/browser/ui/extensions/extension_message_bubble_bridge.cc |
| +++ b/chrome/browser/ui/extensions/extension_message_bubble_bridge.cc |
| @@ -7,6 +7,12 @@ |
| #include <utility> |
| #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "extensions/browser/extension_registry.h" |
| +#include "grit/components_scaled_resources.h" |
| +#include "grit/generated_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| +#include "ui/base/resource/resource_bundle.h" |
| ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge( |
| std::unique_ptr<extensions::ExtensionMessageBubbleController> controller) |
| @@ -74,3 +80,36 @@ void ExtensionMessageBubbleBridge::OnBubbleClosed(CloseAction action) { |
| break; |
| } |
| } |
| + |
| +std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo> |
|
catmullings
2016/08/13 00:35:53
When I remove the "ToolbarActionsBarBubbleDelegate
Devlin
2016/08/22 20:59:41
Within the method, you are within the scope of the
catmullings
2016/08/31 00:03:30
Done.
|
| +ExtensionMessageBubbleBridge::GetExtraViewInfo() { |
| + const extensions::ExtensionIdList& list = controller_->GetExtensionIdList(); |
| + |
| + if (list.empty()) |
|
Devlin
2016/08/22 20:59:41
Can this happen?
catmullings
2016/08/31 00:03:30
W/o digging too deep into the stack, yes, that lin
Devlin
2016/08/31 18:46:45
But if that's true, ShouldShow() returns false, wh
catmullings
2016/09/06 19:16:23
Done.
|
| + return nullptr; |
| + |
| + DCHECK_EQ(1u, list.size()); |
|
Devlin
2016/08/22 20:59:41
This isn't quite true, right? Some bubbles can ha
catmullings
2016/08/31 00:03:30
Yup, originally I had planned to put it in IsPolic
Devlin
2016/08/31 18:46:45
I don't quite follow. A bubble can be shown for m
catmullings
2016/09/06 19:16:22
Fixed. Responding to explain and justify the chang
|
| + const extensions::Extension* extension = |
| + extensions::ExtensionRegistry::Get(controller_->profile()) |
| + ->enabled_extensions() |
| + .GetByID(list[0]); |
| + |
| + if (!extension) |
| + return nullptr; |
| + |
| + std::unique_ptr<ExtraViewInfo> extra_view_info(new ExtraViewInfo); |
|
Devlin
2016/08/22 20:59:41
nit: It doesn't really matter with classes, but I
catmullings
2016/08/31 00:03:30
When/why is explicit construction better than usin
Devlin
2016/08/31 18:46:45
They're orthogonal. Smart ptrs are ownership, but
catmullings
2016/09/06 19:16:22
Done.
|
| + |
| + if (controller_->delegate()->IsPolicyInstallable() && |
|
catmullings
2016/08/13 00:35:53
Equivalent to CanBePolicyInstalled().
I didn't qu
Devlin
2016/08/22 20:59:41
CanBePolicyInstalled/IsPolicyInstallable aren't gr
catmullings
2016/08/31 00:03:30
What you say makes sense, but I'm don't understand
Devlin
2016/08/31 18:46:45
From reading the name, "CanBePolicyInstalled" impl
catmullings
2016/09/06 19:16:22
Done.
|
| + extensions::Manifest::IsPolicyLocation(extension->location())) { |
| + extra_view_info->resource_id = IDR_OMNIBOX_HTTPS_POLICY_WARNING; |
| + extra_view_info->text = |
| + l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN); |
| + extra_view_info->is_text_linked = false; |
| + } else { |
| + extra_view_info->resource_id = -1; |
|
catmullings
2016/08/13 00:35:53
See my question/comment in chrome/browser/ui/toolb
Devlin
2016/08/22 20:59:41
Let's have defaults like this handled by an ExtraV
catmullings
2016/08/31 00:03:30
Done.
|
| + extra_view_info->text = controller_->delegate()->GetLearnMoreLabel(); |
| + extra_view_info->is_text_linked = true; |
| + } |
| + |
| + return extra_view_info; |
| +} |