Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 13 #include "chrome/browser/platform_util.h" | |
|
tapted
2016/05/11 07:06:19
nit: is this needed here?
Elly Fong-Jones
2016/05/11 19:16:38
Done.
| |
| 12 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" | 14 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" |
| 15 #include "ui/gfx/geometry/point.h" | |
| 13 #include "ui/views/bubble/bubble_border.h" | 16 #include "ui/views/bubble/bubble_border.h" |
| 14 | 17 |
| 15 namespace views { | 18 namespace views { |
| 16 class View; | 19 class View; |
| 17 } | 20 } |
| 18 | 21 |
| 19 class Browser; | 22 class Browser; |
| 20 class PermissionsBubbleDialogDelegateView; | 23 class PermissionsBubbleDialogDelegateView; |
| 21 | 24 |
| 22 class PermissionBubbleViewViews : public PermissionBubbleView { | 25 class PermissionBubbleViewViews : public PermissionBubbleView { |
| 23 public: | 26 public: |
| 27 // A PermissionBubbleViewViews owns an AnchorDelegate, which is passed in when | |
|
tapted
2016/05/11 07:06:19
nit: update comment (e.g. the delegate is no longe
Elly Fong-Jones
2016/05/11 19:16:38
Done.
| |
| 28 // constructing the PermissionBubbleViewViews. The AnchorDelegate is | |
| 29 // responsible for determining the anchor view (or point, for platforms | |
| 30 // without an appropriate native view) and the immediate parent NativeView of | |
| 31 // this view. | |
| 32 class AnchorDelegate { | |
| 33 public: | |
| 34 AnchorDelegate() {} | |
| 35 virtual ~AnchorDelegate() {} | |
|
tapted
2016/05/11 07:06:19
(removing all 3 AnchorDelegate destructors should
Elly Fong-Jones
2016/05/11 19:16:38
Done.
| |
| 36 virtual views::View* GetAnchorView() = 0; | |
| 37 virtual gfx::Point GetAnchorPoint() = 0; | |
| 38 }; | |
| 39 | |
| 24 explicit PermissionBubbleViewViews(Browser* browser); | 40 explicit PermissionBubbleViewViews(Browser* browser); |
| 25 ~PermissionBubbleViewViews() override; | 41 ~PermissionBubbleViewViews() override; |
| 26 | 42 |
| 27 // PermissionBubbleView: | 43 // PermissionBubbleView: |
| 28 void SetDelegate(Delegate* delegate) override; | 44 void SetDelegate(Delegate* delegate) override; |
| 29 void Show(const std::vector<PermissionBubbleRequest*>& requests, | 45 void Show(const std::vector<PermissionBubbleRequest*>& requests, |
| 30 const std::vector<bool>& accept_state) override; | 46 const std::vector<bool>& accept_state) override; |
| 31 bool CanAcceptRequestUpdate() override; | 47 bool CanAcceptRequestUpdate() override; |
| 32 void Hide() override; | 48 void Hide() override; |
| 33 bool IsVisible() override; | 49 bool IsVisible() override; |
| 34 void UpdateAnchorPosition() override; | 50 void UpdateAnchorPosition() override; |
| 35 gfx::NativeWindow GetNativeWindow() override; | 51 gfx::NativeWindow GetNativeWindow() override; |
| 36 | 52 |
| 37 void Closing(); | 53 void Closing(); |
| 38 void Toggle(int index, bool value); | 54 void Toggle(int index, bool value); |
| 39 void Accept(); | 55 void Accept(); |
| 40 void Deny(); | 56 void Deny(); |
| 41 | 57 |
| 42 private: | 58 private: |
| 43 views::View* GetAnchorView(); | |
| 44 views::BubbleBorder::Arrow GetAnchorArrow(); | 59 views::BubbleBorder::Arrow GetAnchorArrow(); |
| 45 | 60 |
| 61 static std::unique_ptr<AnchorDelegate> CreateAnchorDelegate(Browser* browser); | |
|
tapted
2016/05/11 07:06:19
nit: needs a comment - (be sure to mention that it
Elly Fong-Jones
2016/05/11 19:16:38
Done.
| |
| 62 | |
| 46 Browser* browser_; | 63 Browser* browser_; |
| 47 Delegate* delegate_; | 64 Delegate* delegate_; |
| 48 PermissionsBubbleDialogDelegateView* bubble_delegate_; | 65 PermissionsBubbleDialogDelegateView* bubble_delegate_; |
| 66 std::unique_ptr<AnchorDelegate> anchor_delegate_; | |
| 49 | 67 |
| 50 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews); | 68 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews); |
| 51 }; | 69 }; |
| 52 | 70 |
| 53 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ | 71 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ |
| OLD | NEW |