Chromium Code Reviews| Index: chrome/browser/ui/views/website_settings/permissions_bubble_view.h |
| diff --git a/chrome/browser/ui/views/website_settings/permissions_bubble_view.h b/chrome/browser/ui/views/website_settings/permissions_bubble_view.h |
| index ccc94dea2b10823d948fdb4f0145a939c1fa485b..78280cb204b61756fb1b354a61b28fb839756689 100644 |
| --- a/chrome/browser/ui/views/website_settings/permissions_bubble_view.h |
| +++ b/chrome/browser/ui/views/website_settings/permissions_bubble_view.h |
| @@ -5,11 +5,13 @@ |
| #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ |
| #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ |
| +#include <memory> |
| #include <string> |
| #include "base/compiler_specific.h" |
| #include "base/macros.h" |
| #include "chrome/browser/ui/website_settings/permission_bubble_view.h" |
| +#include "ui/gfx/geometry/point.h" |
| #include "ui/views/bubble/bubble_border.h" |
| namespace views { |
| @@ -21,6 +23,19 @@ class PermissionsBubbleDialogDelegateView; |
| class PermissionBubbleViewViews : public PermissionBubbleView { |
| public: |
| + // A PermissionBubbleViewViews owns an AnchorDelegate, which is constructed by |
| + // calling PermissionBubbleViewViews::CreateAnchorDelegate. The AnchorDelegate |
| + // is responsible for determining the anchor view (or point, for platforms |
| + // without an appropriate native view) and the immediate parent NativeView of |
| + // this view. |
| + class AnchorDelegate { |
|
msw
2016/05/18 18:57:00
I don't really like the added complexity of this A
Elly Fong-Jones
2016/05/18 19:13:11
I think this technique will run into trouble for m
msw
2016/05/18 19:26:21
Ah, and this views bubble is used for the cocoa br
|
| + public: |
| + AnchorDelegate() {} |
| + virtual views::View* GetAnchorView() = 0; |
| + virtual gfx::Point GetAnchorPoint() = 0; |
| + virtual views::BubbleBorder::Arrow GetAnchorArrow() = 0; |
| + }; |
| + |
| explicit PermissionBubbleViewViews(Browser* browser); |
| ~PermissionBubbleViewViews() override; |
| @@ -40,12 +55,14 @@ class PermissionBubbleViewViews : public PermissionBubbleView { |
| void Deny(); |
| private: |
| - views::View* GetAnchorView(); |
| - views::BubbleBorder::Arrow GetAnchorArrow(); |
| + // This function has separate implementations for Views-based and Cocoa-based |
| + // browsers. |
| + static std::unique_ptr<AnchorDelegate> CreateAnchorDelegate(Browser* browser); |
| Browser* browser_; |
| Delegate* delegate_; |
| PermissionsBubbleDialogDelegateView* bubble_delegate_; |
| + std::unique_ptr<AnchorDelegate> anchor_delegate_; |
| DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews); |
| }; |