Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: chrome/browser/ui/extensions/extension_message_bubble_bridge.cc

Issue 2206693002: Improve settings override bubble to indicate policy installed extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Non-Mac implementation of badge/extra view, that is, admin icon and text Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f5c206ebef2ff5471f3194a0ce44a44ae4d80be0 100644
--- a/chrome/browser/ui/extensions/extension_message_bubble_bridge.cc
+++ b/chrome/browser/ui/extensions/extension_message_bubble_bridge.cc
@@ -7,6 +7,13 @@
#include <utility>
#include "chrome/browser/extensions/extension_message_bubble_controller.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h"
Devlin 2016/08/02 20:34:05 This is included in the .h; no need for it here.
catmullings 2016/08/13 00:35:52 Done.
+#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 +81,40 @@ void ExtensionMessageBubbleBridge::OnBubbleClosed(CloseAction action) {
break;
}
}
+
+std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>
+ExtensionMessageBubbleBridge::GetExtraViewInfo() {
+ extensions::ExtensionIdList list = controller_->GetExtensionIdList();
Devlin 2016/08/02 20:34:05 const & to avoid a copy.
catmullings 2016/08/13 00:35:52 Done.
+
+ if (list.empty())
+ return NULL;
+
+ std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>
Devlin 2016/08/02 20:34:05 nit: since this is in the scope of the bridge clas
catmullings 2016/08/13 00:35:52 Done.
+ extra_view_info(nullptr);
+
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(controller_->profile());
+ for (const std::string& id : list) {
+ const extensions::Extension* extension = registry->GetExtensionById(
+ id, extensions::ExtensionRegistry::EVERYTHING);
Devlin 2016/08/02 20:34:05 I think we should only be worried about enabled ex
catmullings 2016/08/13 00:35:52 With the changes below, this is no longer relevant
+ if (!extension &&
+ !extensions::Manifest::IsPolicyLocation(extension->location())) {
+ continue;
+ }
+ extra_view_info =
+ std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>(
+ new ToolbarActionsBarBubbleDelegate::ExtraViewInfo);
+ extra_view_info->icon = new views::ImageView();
+ extra_view_info->icon->SetImage(
+ ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_OMNIBOX_HTTPS_POLICY_WARNING));
+
+ extra_view_info->text =
+ l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN);
+
+ // TODO: Stop after first policy extension encountered. Figure out how
Devlin 2016/08/02 20:34:05 For this first version, I think it's reasonable to
catmullings 2016/08/13 00:35:52 I don't mind the name CanBePolicyInstalled(); it d
Devlin 2016/08/22 20:59:41 With the bubbles that this is relevant for, we sho
+ // handle multiple policy extensions.
+ break;
+ }
+ return extra_view_info;
Devlin 2016/08/02 20:34:05 We still need to handle the case where the extensi
catmullings 2016/08/13 00:35:52 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698