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

Side by Side Diff: chrome/browser/permissions/permission_prompt_android.h

Issue 2755593002: Remove pointer from PermissionPromptAndroid to InfoBar (Closed)
Patch Set: rebase over 2757483002 Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
7 7
8 #include "chrome/browser/ui/website_settings/permission_prompt.h" 8 #include "chrome/browser/ui/website_settings/permission_prompt.h"
9 9
10 class InfoBarService;
11
12 namespace content { 10 namespace content {
13 class WebContents; 11 class WebContents;
14 } 12 }
15 13
16 namespace infobars {
17 class InfoBar;
18 }
19
20 class PermissionPromptAndroid : public PermissionPrompt { 14 class PermissionPromptAndroid : public PermissionPrompt {
21 public: 15 public:
22 explicit PermissionPromptAndroid(content::WebContents* web_contents); 16 explicit PermissionPromptAndroid(content::WebContents* web_contents);
23 ~PermissionPromptAndroid() override; 17 ~PermissionPromptAndroid() override;
24 18
25 // PermissionPrompt: 19 // PermissionPrompt:
26 void SetDelegate(Delegate* delegate) override; 20 void SetDelegate(Delegate* delegate) override;
27 void Show(const std::vector<PermissionRequest*>& requests, 21 void Show(const std::vector<PermissionRequest*>& requests,
28 const std::vector<bool>& accept_state) override; 22 const std::vector<bool>& accept_state) override;
29 bool CanAcceptRequestUpdate() override; 23 bool CanAcceptRequestUpdate() override;
30 void Hide() override; 24 void Hide() override;
31 bool IsVisible() override; 25 bool IsVisible() override;
32 void UpdateAnchorPosition() override; 26 void UpdateAnchorPosition() override;
33 gfx::NativeWindow GetNativeWindow() override; 27 gfx::NativeWindow GetNativeWindow() override;
34 28
35 void Closing(); 29 void Closing();
36 void ToggleAccept(int index, bool value); 30 void ToggleAccept(int index, bool value);
37 void Accept(); 31 void Accept();
38 void Deny(); 32 void Deny();
39 33
40 const std::vector<PermissionRequest*>& Requests() { return requests_; } 34 const std::vector<PermissionRequest*>& Requests() { return requests_; }
41 35
42 private: 36 private:
43 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should 37 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should
44 // be safe to hold a raw WebContents pointer here because this class is 38 // be safe to hold a raw WebContents pointer here because this class is
45 // destroyed before the WebContents. 39 // destroyed before the WebContents.
46 content::WebContents* web_contents_; 40 content::WebContents* web_contents_;
47 // |delegate_| is the PermissionRequestManager, which owns this object. 41 // |delegate_| is the PermissionRequestManager, which owns this object.
48 Delegate* delegate_; 42 Delegate* delegate_;
49 // |infobar_| is owned by the InfoBarService; we keep a pointer here so we can 43
50 // ask the service to remove the infobar after it is added.
51 infobars::InfoBar* infobar_;
52 // The current request being displayed (if any). 44 // The current request being displayed (if any).
53 std::vector<PermissionRequest*> requests_; 45 std::vector<PermissionRequest*> requests_;
54 46
55 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); 47 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid);
56 }; 48 };
57 49
58 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 50 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698