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

Side by Side Diff: content/browser/permissions/permission_service_impl.h

Issue 1019173002: Update mojo sdk to rev 7214b7ec7d27563b2666afad86cf1c5895c56c18 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep permission service alive if embedder drops requests Created 5 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
« no previous file with comments | « build/module_args/mojo.gni ('k') | content/browser/permissions/permission_service_impl.cc » ('j') | 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 CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_
7 7
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 18 matching lines...) Expand all
29 // browser to cancel the permission requests. 29 // browser to cancel the permission requests.
30 void CancelPendingRequests(); 30 void CancelPendingRequests();
31 31
32 protected: 32 protected:
33 friend PermissionServiceContext; 33 friend PermissionServiceContext;
34 34
35 PermissionServiceImpl(PermissionServiceContext* context); 35 PermissionServiceImpl(PermissionServiceContext* context);
36 36
37 private: 37 private:
38 struct PendingRequest { 38 struct PendingRequest {
39 PendingRequest(PermissionType permission, const GURL& origin); 39 PendingRequest(PermissionType permission, const GURL& origin,
40 const mojo::Callback<void(PermissionStatus)>& callback);
41 ~PendingRequest();
42
40 PermissionType permission; 43 PermissionType permission;
41 GURL origin; 44 GURL origin;
45 mojo::Callback<void(PermissionStatus)> callback;
42 }; 46 };
43 typedef IDMap<PendingRequest, IDMapOwnPointer> RequestsMap; 47 typedef IDMap<PendingRequest, IDMapOwnPointer> RequestsMap;
44 48
45 // PermissionService. 49 // PermissionService.
46 void HasPermission( 50 void HasPermission(
47 PermissionName permission, 51 PermissionName permission,
48 const mojo::String& origin, 52 const mojo::String& origin,
49 const mojo::Callback<void(PermissionStatus)>& callback) override; 53 const mojo::Callback<void(PermissionStatus)>& callback) override;
50 void RequestPermission( 54 void RequestPermission(
51 PermissionName permission, 55 PermissionName permission,
52 const mojo::String& origin, 56 const mojo::String& origin,
53 bool user_gesture, 57 bool user_gesture,
54 const mojo::Callback<void(PermissionStatus)>& callback) override; 58 const mojo::Callback<void(PermissionStatus)>& callback) override;
55 void RevokePermission( 59 void RevokePermission(
56 PermissionName permission, 60 PermissionName permission,
57 const mojo::String& origin, 61 const mojo::String& origin,
58 const mojo::Callback<void(PermissionStatus)>& callback) override; 62 const mojo::Callback<void(PermissionStatus)>& callback) override;
59 63
60 // mojo::InterfaceImpl. 64 // mojo::InterfaceImpl.
61 void OnConnectionError() override; 65 void OnConnectionError() override;
62 66
63 void OnRequestPermissionResponse( 67 void OnRequestPermissionResponse(int request_id, PermissionStatus status);
64 const mojo::Callback<void(PermissionStatus)>& callback,
65 int request_id,
66 PermissionStatus status);
67 68
68 PermissionStatus GetPermissionStatus(PermissionType type, GURL origin); 69 PermissionStatus GetPermissionStatus(PermissionType type, GURL origin);
69 void ResetPermissionStatus(PermissionType type, GURL origin); 70 void ResetPermissionStatus(PermissionType type, GURL origin);
70 71
71 RequestsMap pending_requests_; 72 RequestsMap pending_requests_;
72 // context_ owns |this|. 73 // context_ owns |this|.
73 PermissionServiceContext* context_; 74 PermissionServiceContext* context_;
74 base::WeakPtrFactory<PermissionServiceImpl> weak_factory_; 75 base::WeakPtrFactory<PermissionServiceImpl> weak_factory_;
75 76
76 DISALLOW_COPY_AND_ASSIGN(PermissionServiceImpl); 77 DISALLOW_COPY_AND_ASSIGN(PermissionServiceImpl);
77 }; 78 };
78 79
79 } // namespace content 80 } // namespace content
80 81
81 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_ 82 #endif // CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « build/module_args/mojo.gni ('k') | content/browser/permissions/permission_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698