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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" 13 #include "chrome/browser/ui/website_settings/permission_bubble_view.h"
14 #include "ui/gfx/geometry/point.h"
13 #include "ui/views/bubble/bubble_border.h" 15 #include "ui/views/bubble/bubble_border.h"
14 16
15 namespace views { 17 namespace views {
16 class View; 18 class View;
17 } 19 }
18 20
19 class Browser; 21 class Browser;
20 class PermissionsBubbleDialogDelegateView; 22 class PermissionsBubbleDialogDelegateView;
21 23
22 class PermissionBubbleViewViews : public PermissionBubbleView { 24 class PermissionBubbleViewViews : public PermissionBubbleView {
23 public: 25 public:
24 explicit PermissionBubbleViewViews(Browser* browser); 26 // A PermissionBubbleViewViews owns an AnchorDelegate, which is passed in when
27 // constructing the PermissionBubbleViewViews. The AnchorDelegate is
28 // responsible for determining the anchor view (or point, for platforms
29 // without an appropriate native view) and the immediate parent NativeView of
30 // this view.
31 class AnchorDelegate {
32 public:
33 AnchorDelegate(){}
tapted 2016/05/03 12:02:39 nit: space before {}
Elly Fong-Jones 2016/05/10 21:21:02 Done.
34 virtual ~AnchorDelegate(){}
tapted 2016/05/03 12:02:39 I think we can omit the destructor altogether for
Elly Fong-Jones 2016/05/10 21:21:02 Then the destructor isn't virtual and can't be ove
tapted 2016/05/11 07:06:18 I don't think we need to override it in the childr
35 virtual views::View* GetAnchorView() = 0;
36 virtual gfx::Point GetAnchorPoint() = 0;
37 virtual gfx::NativeView GetParentView() = 0;
38 };
39
40 PermissionBubbleViewViews(Browser* browser,
41 std::unique_ptr<AnchorDelegate> anchor_delegate);
tapted 2016/05/03 12:02:39 Since both AnchorDelegates are just created from t
Elly Fong-Jones 2016/05/10 21:21:02 Done.
25 ~PermissionBubbleViewViews() override; 42 ~PermissionBubbleViewViews() override;
26 43
27 // PermissionBubbleView: 44 // PermissionBubbleView:
28 void SetDelegate(Delegate* delegate) override; 45 void SetDelegate(Delegate* delegate) override;
29 void Show(const std::vector<PermissionBubbleRequest*>& requests, 46 void Show(const std::vector<PermissionBubbleRequest*>& requests,
30 const std::vector<bool>& accept_state) override; 47 const std::vector<bool>& accept_state) override;
31 bool CanAcceptRequestUpdate() override; 48 bool CanAcceptRequestUpdate() override;
32 void Hide() override; 49 void Hide() override;
33 bool IsVisible() override; 50 bool IsVisible() override;
34 void UpdateAnchorPosition() override; 51 void UpdateAnchorPosition() override;
35 gfx::NativeWindow GetNativeWindow() override; 52 gfx::NativeWindow GetNativeWindow() override;
36 53
37 void Closing(); 54 void Closing();
38 void Toggle(int index, bool value); 55 void Toggle(int index, bool value);
39 void Accept(); 56 void Accept();
40 void Deny(); 57 void Deny();
41 58
42 private: 59 private:
43 views::View* GetAnchorView(); 60 views::View* GetAnchorView();
61 gfx::Point GetAnchorPoint();
tapted 2016/05/03 12:02:39 this might not be needed. In fact we can probably
Elly Fong-Jones 2016/05/10 21:21:02 Done.
44 views::BubbleBorder::Arrow GetAnchorArrow(); 62 views::BubbleBorder::Arrow GetAnchorArrow();
45 63
46 Browser* browser_; 64 Browser* browser_;
47 Delegate* delegate_; 65 Delegate* delegate_;
48 PermissionsBubbleDialogDelegateView* bubble_delegate_; 66 PermissionsBubbleDialogDelegateView* bubble_delegate_;
67 std::unique_ptr<AnchorDelegate> anchor_delegate_;
49 68
50 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews); 69 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews);
51 }; 70 };
52 71
53 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ 72 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698