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

Side by Side 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/extensions/extension_message_bubble_controller.h" 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
10 #include "chrome/browser/profiles/profile.h"
11 #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.
12 #include "extensions/browser/extension_registry.h"
13 #include "grit/components_scaled_resources.h"
14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h"
10 17
11 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge( 18 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge(
12 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller) 19 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller)
13 : controller_(std::move(controller)) {} 20 : controller_(std::move(controller)) {}
14 21
15 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {} 22 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {}
16 23
17 bool ExtensionMessageBubbleBridge::ShouldShow() { 24 bool ExtensionMessageBubbleBridge::ShouldShow() {
18 return controller_->ShouldShow(); 25 return controller_->ShouldShow();
19 } 26 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 break; 74 break;
68 } 75 }
69 case CLOSE_EXECUTE: 76 case CLOSE_EXECUTE:
70 controller_->OnBubbleAction(); 77 controller_->OnBubbleAction();
71 break; 78 break;
72 case CLOSE_LEARN_MORE: 79 case CLOSE_LEARN_MORE:
73 controller_->OnLinkClicked(); 80 controller_->OnLinkClicked();
74 break; 81 break;
75 } 82 }
76 } 83 }
84
85 std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>
86 ExtensionMessageBubbleBridge::GetExtraViewInfo() {
87 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.
88
89 if (list.empty())
90 return NULL;
91
92 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.
93 extra_view_info(nullptr);
94
95 extensions::ExtensionRegistry* registry =
96 extensions::ExtensionRegistry::Get(controller_->profile());
97 for (const std::string& id : list) {
98 const extensions::Extension* extension = registry->GetExtensionById(
99 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
100 if (!extension &&
101 !extensions::Manifest::IsPolicyLocation(extension->location())) {
102 continue;
103 }
104 extra_view_info =
105 std::unique_ptr<ToolbarActionsBarBubbleDelegate::ExtraViewInfo>(
106 new ToolbarActionsBarBubbleDelegate::ExtraViewInfo);
107 extra_view_info->icon = new views::ImageView();
108 extra_view_info->icon->SetImage(
109 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
110 IDR_OMNIBOX_HTTPS_POLICY_WARNING));
111
112 extra_view_info->text =
113 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN);
114
115 // 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
116 // handle multiple policy extensions.
117 break;
118 }
119 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.
120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698