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

Side by Side Diff: chrome/browser/ui/website_settings/permission_prompt.h

Issue 2335623002: Use WebContents instead of Browser to construct PermissionPrompt (Closed)
Patch Set: address review comments Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/website_settings/mock_permission_prompt_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WEBSITE_SETTINGS_PERMISSION_PROMPT_H_ 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_PROMPT_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_PROMPT_H_ 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_PROMPT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
13 13
14 class Browser;
15 class PermissionRequestManager; 14 class PermissionRequestManager;
16 class PermissionRequest; 15 class PermissionRequest;
17 16
17 namespace content {
18 class WebContents;
19 }
20
18 // This class is the platform-independent interface through which the permission 21 // This class is the platform-independent interface through which the permission
19 // request managers (which are one per tab) communicate to the UI surface. 22 // request managers (which are one per tab) communicate to the UI surface.
20 // When the visible tab changes, the UI code must provide an object of this type 23 // When the visible tab changes, the UI code must provide an object of this type
21 // to the manager for the visible tab. 24 // to the manager for the visible tab.
22 class PermissionPrompt { 25 class PermissionPrompt {
23 public: 26 public:
24 // The delegate will receive events caused by user action which need to 27 // The delegate will receive events caused by user action which need to
25 // be persisted in the per-tab UI state. 28 // be persisted in the per-tab UI state.
26 class Delegate { 29 class Delegate {
27 public: 30 public:
28 virtual ~Delegate() {} 31 virtual ~Delegate() {}
29 32
30 virtual void ToggleAccept(int index, bool new_value) = 0; 33 virtual void ToggleAccept(int index, bool new_value) = 0;
31 virtual void Accept() = 0; 34 virtual void Accept() = 0;
32 virtual void Deny() = 0; 35 virtual void Deny() = 0;
33 virtual void Closing() = 0; 36 virtual void Closing() = 0;
34 }; 37 };
35 38
36 typedef base::Callback<std::unique_ptr<PermissionPrompt>(Browser*)> Factory; 39 typedef base::Callback<std::unique_ptr<PermissionPrompt>(
40 content::WebContents*)>
41 Factory;
37 42
38 // Create a platform specific instance. 43 // Create a platform specific instance.
39 static std::unique_ptr<PermissionPrompt> Create(Browser* browser); 44 static std::unique_ptr<PermissionPrompt> Create(
45 content::WebContents* web_contents);
40 virtual ~PermissionPrompt() {} 46 virtual ~PermissionPrompt() {}
41 47
42 // Sets the delegate which will receive UI events forwarded from the prompt. 48 // Sets the delegate which will receive UI events forwarded from the prompt.
43 virtual void SetDelegate(Delegate* delegate) = 0; 49 virtual void SetDelegate(Delegate* delegate) = 0;
44 50
45 // Causes the request UI to show up with the given contents. This method may 51 // Causes the request UI to show up with the given contents. This method may
46 // be called with mostly-identical contents to the existing contents. This can 52 // be called with mostly-identical contents to the existing contents. This can
47 // happen, for instance, if a new permission is requested and 53 // happen, for instance, if a new permission is requested and
48 // CanAcceptRequestUpdate() is true. 54 // CanAcceptRequestUpdate() is true.
49 // Important: the view must not store any of the request objects it receives 55 // Important: the view must not store any of the request objects it receives
(...skipping 14 matching lines...) Expand all
64 70
65 // Updates where the prompt should be anchored. ex: fullscreen toggle. 71 // Updates where the prompt should be anchored. ex: fullscreen toggle.
66 virtual void UpdateAnchorPosition() = 0; 72 virtual void UpdateAnchorPosition() = 0;
67 73
68 // Returns a reference to this prompt's native window. 74 // Returns a reference to this prompt's native window.
69 // TODO(hcarmona): Remove this as part of the bubble API work. 75 // TODO(hcarmona): Remove this as part of the bubble API work.
70 virtual gfx::NativeWindow GetNativeWindow() = 0; 76 virtual gfx::NativeWindow GetNativeWindow() = 0;
71 }; 77 };
72 78
73 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_PROMPT_H_ 79 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_PROMPT_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/mock_permission_prompt_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698