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