Chromium Code Reviews| 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 "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 "extensions/browser/extension_registry.h" | |
| 12 #include "grit/components_scaled_resources.h" | |
| 13 #include "grit/generated_resources.h" | |
| 14 #include "ui/base/l10n/l10n_util.h" | |
| 15 #include "ui/base/resource/resource_bundle.h" | |
| 10 | 16 |
| 11 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge( | 17 ExtensionMessageBubbleBridge::ExtensionMessageBubbleBridge( |
| 12 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller) | 18 std::unique_ptr<extensions::ExtensionMessageBubbleController> controller) |
| 13 : controller_(std::move(controller)) {} | 19 : controller_(std::move(controller)) {} |
| 14 | 20 |
| 15 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {} | 21 ExtensionMessageBubbleBridge::~ExtensionMessageBubbleBridge() {} |
| 16 | 22 |
| 17 bool ExtensionMessageBubbleBridge::ShouldShow() { | 23 bool ExtensionMessageBubbleBridge::ShouldShow() { |
| 18 return controller_->ShouldShow(); | 24 return controller_->ShouldShow(); |
| 19 } | 25 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 break; | 73 break; |
| 68 } | 74 } |
| 69 case CLOSE_EXECUTE: | 75 case CLOSE_EXECUTE: |
| 70 controller_->OnBubbleAction(); | 76 controller_->OnBubbleAction(); |
| 71 break; | 77 break; |
| 72 case CLOSE_LEARN_MORE: | 78 case CLOSE_LEARN_MORE: |
| 73 controller_->OnLinkClicked(); | 79 controller_->OnLinkClicked(); |
| 74 break; | 80 break; |
| 75 } | 81 } |
| 76 } | 82 } |
| 83 | |
| 84 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.
| |
| 85 ExtensionMessageBubbleBridge::GetExtraViewInfo() { | |
| 86 const extensions::ExtensionIdList& list = controller_->GetExtensionIdList(); | |
| 87 | |
| 88 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.
| |
| 89 return nullptr; | |
| 90 | |
| 91 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
| |
| 92 const extensions::Extension* extension = | |
| 93 extensions::ExtensionRegistry::Get(controller_->profile()) | |
| 94 ->enabled_extensions() | |
| 95 .GetByID(list[0]); | |
| 96 | |
| 97 if (!extension) | |
| 98 return nullptr; | |
| 99 | |
| 100 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.
| |
| 101 | |
| 102 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.
| |
| 103 extensions::Manifest::IsPolicyLocation(extension->location())) { | |
| 104 extra_view_info->resource_id = IDR_OMNIBOX_HTTPS_POLICY_WARNING; | |
| 105 extra_view_info->text = | |
| 106 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INSTALLED_BY_ADMIN); | |
| 107 extra_view_info->is_text_linked = false; | |
| 108 } else { | |
| 109 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.
| |
| 110 extra_view_info->text = controller_->delegate()->GetLearnMoreLabel(); | |
| 111 extra_view_info->is_text_linked = true; | |
| 112 } | |
| 113 | |
| 114 return extra_view_info; | |
| 115 } | |
| OLD | NEW |