| 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 <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // A PermissionBubbleViewViews owns an AnchorDelegate, which is constructed by | 26 // A PermissionBubbleViewViews owns an AnchorDelegate, which is constructed by |
| 27 // calling PermissionBubbleViewViews::CreateAnchorDelegate. The AnchorDelegate | 27 // calling PermissionBubbleViewViews::CreateAnchorDelegate. The AnchorDelegate |
| 28 // is responsible for determining the anchor view (or point, for platforms | 28 // is responsible for determining the anchor view (or point, for platforms |
| 29 // without an appropriate native view) and the immediate parent NativeView of | 29 // without an appropriate native view) and the immediate parent NativeView of |
| 30 // this view. | 30 // this view. |
| 31 class AnchorDelegate { | 31 class AnchorDelegate { |
| 32 public: | 32 public: |
| 33 AnchorDelegate() {} | 33 AnchorDelegate() {} |
| 34 virtual views::View* GetAnchorView() = 0; | 34 virtual views::View* GetAnchorView() = 0; |
| 35 virtual gfx::Point GetAnchorPoint() = 0; | 35 virtual gfx::Point GetAnchorPoint() = 0; |
| 36 virtual views::BubbleBorder::Arrow GetAnchorArrow() = 0; |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 explicit PermissionBubbleViewViews(Browser* browser); | 39 explicit PermissionBubbleViewViews(Browser* browser); |
| 39 ~PermissionBubbleViewViews() override; | 40 ~PermissionBubbleViewViews() override; |
| 40 | 41 |
| 41 // PermissionBubbleView: | 42 // PermissionBubbleView: |
| 42 void SetDelegate(Delegate* delegate) override; | 43 void SetDelegate(Delegate* delegate) override; |
| 43 void Show(const std::vector<PermissionBubbleRequest*>& requests, | 44 void Show(const std::vector<PermissionBubbleRequest*>& requests, |
| 44 const std::vector<bool>& accept_state) override; | 45 const std::vector<bool>& accept_state) override; |
| 45 bool CanAcceptRequestUpdate() override; | 46 bool CanAcceptRequestUpdate() override; |
| 46 void Hide() override; | 47 void Hide() override; |
| 47 bool IsVisible() override; | 48 bool IsVisible() override; |
| 48 void UpdateAnchorPosition() override; | 49 void UpdateAnchorPosition() override; |
| 49 gfx::NativeWindow GetNativeWindow() override; | 50 gfx::NativeWindow GetNativeWindow() override; |
| 50 | 51 |
| 51 void Closing(); | 52 void Closing(); |
| 52 void Toggle(int index, bool value); | 53 void Toggle(int index, bool value); |
| 53 void Accept(); | 54 void Accept(); |
| 54 void Deny(); | 55 void Deny(); |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 views::BubbleBorder::Arrow GetAnchorArrow(); | |
| 58 | |
| 59 // This function has separate implementations for Views-based and Cocoa-based | 58 // This function has separate implementations for Views-based and Cocoa-based |
| 60 // browsers. | 59 // browsers. |
| 61 static std::unique_ptr<AnchorDelegate> CreateAnchorDelegate(Browser* browser); | 60 static std::unique_ptr<AnchorDelegate> CreateAnchorDelegate(Browser* browser); |
| 62 | 61 |
| 63 Browser* browser_; | 62 Browser* browser_; |
| 64 Delegate* delegate_; | 63 Delegate* delegate_; |
| 65 PermissionsBubbleDialogDelegateView* bubble_delegate_; | 64 PermissionsBubbleDialogDelegateView* bubble_delegate_; |
| 66 std::unique_ptr<AnchorDelegate> anchor_delegate_; | 65 std::unique_ptr<AnchorDelegate> anchor_delegate_; |
| 67 | 66 |
| 68 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews); | 67 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleViewViews); |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ | 70 #endif // CHROME_BROWSER_UI_VIEWS_WEBSITE_SETTINGS_PERMISSIONS_BUBBLE_VIEW_H_ |
| OLD | NEW |