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

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

Issue 2868783002: Move requests from Show() argument to PermissionPrompt::Delegate (Closed)
Patch Set: rm vector on android Created 3 years, 7 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 <vector> 8 #include <vector>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "chrome/browser/ui/permission_bubble/permission_prompt.h" 11 #include "chrome/browser/ui/permission_bubble/permission_prompt.h"
12 #include "components/content_settings/core/common/content_settings_types.h" 12 #include "components/content_settings/core/common/content_settings_types.h"
13 13
14 class PermissionRequest;
15
16 namespace content { 14 namespace content {
17 class WebContents; 15 class WebContents;
18 } 16 }
19 17
20 class PermissionPromptAndroid : public PermissionPrompt { 18 class PermissionPromptAndroid : public PermissionPrompt {
21 public: 19 public:
22 explicit PermissionPromptAndroid(content::WebContents* web_contents); 20 explicit PermissionPromptAndroid(content::WebContents* web_contents);
23 ~PermissionPromptAndroid() override; 21 ~PermissionPromptAndroid() override;
24 22
25 // PermissionPrompt: 23 // PermissionPrompt:
26 void SetDelegate(Delegate* delegate) override; 24 void SetDelegate(Delegate* delegate) override;
27 void Show(const std::vector<PermissionRequest*>& requests, 25 void Show() override;
28 const std::vector<bool>& accept_state) override;
29 bool CanAcceptRequestUpdate() override; 26 bool CanAcceptRequestUpdate() override;
30 bool HidesAutomatically() override; 27 bool HidesAutomatically() override;
31 void Hide() override; 28 void Hide() override;
32 void UpdateAnchorPosition() override; 29 void UpdateAnchorPosition() override;
33 gfx::NativeWindow GetNativeWindow() override; 30 gfx::NativeWindow GetNativeWindow() override;
34 31
35 void Closing(); 32 void Closing();
36 void ToggleAccept(int index, bool value); 33 void ToggleAccept(int index, bool value);
37 void Accept(); 34 void Accept();
38 void Deny(); 35 void Deny();
39 36
40 size_t permission_count() const { return requests_.size(); } 37 size_t permission_count() const { return delegate_->Requests().size(); }
raymes 2017/05/11 01:17:54 nit: we should probably move the implementation in
Timothy Loh 2017/05/11 04:42:08 Done.
41 ContentSettingsType GetContentSettingType(size_t position) const; 38 ContentSettingsType GetContentSettingType(size_t position) const;
42 int GetIconIdForPermission(size_t position) const; 39 int GetIconIdForPermission(size_t position) const;
43 base::string16 GetMessageTextFragment(size_t position) const; 40 base::string16 GetMessageTextFragment(size_t position) const;
44 41
45 private: 42 private:
46 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should 43 // PermissionPromptAndroid is owned by PermissionRequestManager, so it should
47 // be safe to hold a raw WebContents pointer here because this class is 44 // be safe to hold a raw WebContents pointer here because this class is
48 // destroyed before the WebContents. 45 // destroyed before the WebContents.
49 content::WebContents* web_contents_; 46 content::WebContents* web_contents_;
50 // |delegate_| is the PermissionRequestManager, which owns this object. 47 // |delegate_| is the PermissionRequestManager, which owns this object.
51 Delegate* delegate_; 48 Delegate* delegate_;
52 // The current request being displayed (if any).
53 std::vector<PermissionRequest*> requests_;
54 49
55 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid); 50 DISALLOW_COPY_AND_ASSIGN(PermissionPromptAndroid);
56 }; 51 };
57 52
58 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_ 53 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_PROMPT_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698