| 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_PERMISSION_BUBBLE_PERMISSION_PROMPT_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PERMISSION_BUBBLE_PERMISSION_PROMPT_IMPL_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PERMISSION_BUBBLE_PERMISSION_PROMPT_IMPL_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PERMISSION_BUBBLE_PERMISSION_PROMPT_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" | 13 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" |
| 14 #include "ui/gfx/geometry/point.h" | 14 #include "ui/gfx/geometry/point.h" |
| 15 #include "ui/views/bubble/bubble_border.h" | 15 #include "ui/views/bubble/bubble_border.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class View; | 18 class View; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class Browser; | 21 class Browser; |
| 22 class PermissionsBubbleDialogDelegateView; | 22 class PermissionsBubbleDialogDelegateView; |
| 23 class Profile; | |
| 24 | 23 |
| 25 class PermissionPromptImpl : public PermissionPrompt { | 24 class PermissionPromptImpl : public PermissionPrompt { |
| 26 public: | 25 public: |
| 27 explicit PermissionPromptImpl(Browser* browser); | 26 explicit PermissionPromptImpl(Browser* browser); |
| 28 ~PermissionPromptImpl() override; | 27 ~PermissionPromptImpl() override; |
| 29 | 28 |
| 30 // PermissionPrompt: | 29 // PermissionPrompt: |
| 31 void SetDelegate(Delegate* delegate) override; | 30 void SetDelegate(Delegate* delegate) override; |
| 32 void Show() override; | 31 void Show() override; |
| 33 bool CanAcceptRequestUpdate() override; | 32 bool CanAcceptRequestUpdate() override; |
| 34 bool HidesAutomatically() override; | 33 bool HidesAutomatically() override; |
| 35 void Hide() override; | 34 void Hide() override; |
| 36 void UpdateAnchorPosition() override; | 35 void UpdateAnchorPosition() override; |
| 37 gfx::NativeWindow GetNativeWindow() override; | 36 gfx::NativeWindow GetNativeWindow() override; |
| 38 | 37 |
| 39 void Closing(); | 38 void Closing(); |
| 40 void ToggleAccept(int index, bool value); | 39 void ToggleAccept(int index, bool value); |
| 41 void TogglePersist(bool value); | 40 void TogglePersist(bool value); |
| 42 void Accept(); | 41 void Accept(); |
| 43 void Deny(); | 42 void Deny(); |
| 44 | 43 |
| 45 Profile* GetProfile(); | |
| 46 | |
| 47 private: | 44 private: |
| 48 // These three functions have separate implementations for Views-based and | 45 // These three functions have separate implementations for Views-based and |
| 49 // Cocoa-based browsers, to allow this bubble to be used in either. | 46 // Cocoa-based browsers, to allow this bubble to be used in either. |
| 50 | 47 |
| 51 // Returns the view to anchor the permission bubble to. May be null. | 48 // Returns the view to anchor the permission bubble to. May be null. |
| 52 views::View* GetAnchorView(); | 49 views::View* GetAnchorView(); |
| 53 // Returns the anchor point to anchor the permission bubble to, as a fallback. | 50 // Returns the anchor point to anchor the permission bubble to, as a fallback. |
| 54 // Only used if GetAnchorView() returns nullptr. | 51 // Only used if GetAnchorView() returns nullptr. |
| 55 gfx::Point GetAnchorPoint(); | 52 gfx::Point GetAnchorPoint(); |
| 56 // Returns the type of arrow to display on the permission bubble. | 53 // Returns the type of arrow to display on the permission bubble. |
| 57 views::BubbleBorder::Arrow GetAnchorArrow(); | 54 views::BubbleBorder::Arrow GetAnchorArrow(); |
| 58 | 55 |
| 59 Browser* browser_; | 56 Browser* browser_; |
| 60 Delegate* delegate_; | 57 Delegate* delegate_; |
| 61 PermissionsBubbleDialogDelegateView* bubble_delegate_; | 58 PermissionsBubbleDialogDelegateView* bubble_delegate_; |
| 62 | 59 |
| 63 DISALLOW_COPY_AND_ASSIGN(PermissionPromptImpl); | 60 DISALLOW_COPY_AND_ASSIGN(PermissionPromptImpl); |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 #endif // CHROME_BROWSER_UI_VIEWS_PERMISSION_BUBBLE_PERMISSION_PROMPT_IMPL_H_ | 63 #endif // CHROME_BROWSER_UI_VIEWS_PERMISSION_BUBBLE_PERMISSION_PROMPT_IMPL_H_ |
| OLD | NEW |