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

Unified Diff: chrome/browser/ui/views/website_settings/permissions_bubble_view.h

Issue 1935993004: MacViews: support Views permission bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fold in https://codereview.chromium.org/1970113002 and rebase Created 4 years, 7 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/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);
};

Powered by Google App Engine
This is Rietveld 408576698