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

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

Issue 1337903002: permissions: remove PermissionQueueController and introduce PermissionInfoBarManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callbacks-delegates
Patch Set: Try to fix context base tests Created 5 years, 2 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
(Empty)
1 // Copyright 2015 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_PERMISSIONS_PERMISSION_INFOBAR_REQUEST_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_REQUEST_H_
7
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/content_settings/core/common/content_settings.h"
11 #include "url/gurl.h"
12
13 namespace infobars {
14 class InfoBar;
15 } // namespace infobars
16
17 class InfoBarService;
18 class Profile;
19
20 // Represents a permission request which will be displayed using an InfoBar.
21 class PermissionInfoBarRequest {
22 public:
23 PermissionInfoBarRequest(
24 const GURL& requesting_origin,
25 const GURL& embedding_origin,
26 const base::Closure& callback);
27 ~PermissionInfoBarRequest();
28
29 void AddPermission(
mlamouri (slow - plz ping) 2015/09/29 14:02:18 Here and below, please add comments for these meth
Lalit Maganti 2015/10/01 17:05:14 Done.
30 const ContentSettingsType type,
31 const base::Callback<void(bool, ContentSetting)>& response_callback);
32
33 bool ShowInfobar(InfoBarService* infobar_service,
34 Profile* profile);
35
36 void Accept();
37 void Closing();
38 void Cancel();
39
40 private:
41 using PermissionDecidedCallback = base::Callback<void(bool, ContentSetting)>;
42 class PermissionRequest {
43 public:
44 PermissionRequest(ContentSettingsType type,
45 const PermissionDecidedCallback& response_callback);
46 ~PermissionRequest();
47
48 ContentSettingsType type() const { return type_; }
49 const PermissionDecidedCallback& response_callback() const {
50 return response_callback_;
51 }
52
53 private:
54 ContentSettingsType type_;
55 PermissionDecidedCallback response_callback_;
56 };
57
58 void OnExternalRemoval();
59
60 void OnPermissionSet(bool update_content_setting,
61 bool allowed);
62
63 void OnPermissionsSet(bool update_content_setting,
64 const std::vector<ContentSetting>& allowed);
65
66 void PruneAnsweredPermissions(Profile* profile);
67
68 void CreateInfoBar(InfoBarService* infobar_service,
69 const PermissionRequest& request,
70 const std::string& display_languages,
71 const base::Callback<void(bool, bool)>& callback);
72
73 // Owned by InfoBarService.
74 infobars::InfoBar* infobar_;
75
76 GURL requesting_origin_;
77 GURL embedding_origin_;
78 base::Closure callback_;
79 std::vector<PermissionRequest> requests_;
80
81 base::WeakPtrFactory<PermissionInfoBarRequest> weak_factory_;
82
83 DISALLOW_COPY_AND_ASSIGN(PermissionInfoBarRequest);
84 };
85
86 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_INFOBAR_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698