OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "content/shell/browser/shell_permission_manager.h" | 5 #include "content/shell/browser/shell_permission_manager.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "content/public/browser/permission_type.h" | 8 #include "content/public/browser/permission_type.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 ShellPermissionManager::ShellPermissionManager() | 12 ShellPermissionManager::ShellPermissionManager() |
13 : PermissionManager() { | 13 : PermissionManager() { |
14 } | 14 } |
15 | 15 |
16 ShellPermissionManager::~ShellPermissionManager() { | 16 ShellPermissionManager::~ShellPermissionManager() { |
17 } | 17 } |
18 | 18 |
19 void ShellPermissionManager::RequestPermission( | 19 void ShellPermissionManager::RequestPermission( |
20 PermissionType permission, | 20 PermissionType permission, |
21 RenderFrameHost* render_frame_host, | 21 RenderFrameHost* render_frame_host, |
22 int request_id, | 22 int request_id, |
23 const GURL& requesting_origin, | 23 const GURL& requesting_origin, |
24 bool user_gesture, | 24 bool user_gesture, |
25 const base::Callback<void(PermissionStatus)>& callback) { | 25 const RequestCallback& callback) { |
26 callback.Run(permission == PermissionType::GEOLOCATION | 26 callback.Run(permission == PermissionType::GEOLOCATION |
27 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); | 27 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); |
28 } | 28 } |
29 | 29 |
30 void ShellPermissionManager::RequestPermission( | |
31 const std::vector<PermissionType>& permissions, | |
32 content::RenderFrameHost* render_frame_host, | |
33 int request_id, | |
34 const GURL& requesting_origin, | |
35 bool user_gesture, | |
36 const BatchRequestCallback& callback) { | |
37 std::vector<PermissionStatus> statuses(permissions.size(), | |
38 PERMISSION_STATUS_DENIED); | |
39 for (size_t i = 0; i < permissions.size(); i++) { | |
40 statuses[i] = permissions[i] == PermissionType::GEOLOCATION | |
mlamouri (slow - plz ping)
2015/09/02 11:36:42
Same as above.
| |
41 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED; | |
42 } | |
43 callback.Run(statuses); | |
44 } | |
45 | |
30 void ShellPermissionManager::CancelPermissionRequest( | 46 void ShellPermissionManager::CancelPermissionRequest( |
31 PermissionType permission, | |
32 RenderFrameHost* render_frame_host, | 47 RenderFrameHost* render_frame_host, |
33 int request_id, | 48 int request_id) { |
34 const GURL& requesting_origin) { | |
35 } | 49 } |
36 | 50 |
37 void ShellPermissionManager::ResetPermission( | 51 void ShellPermissionManager::ResetPermission( |
38 PermissionType permission, | 52 PermissionType permission, |
39 const GURL& requesting_origin, | 53 const GURL& requesting_origin, |
40 const GURL& embedding_origin) { | 54 const GURL& embedding_origin) { |
41 } | 55 } |
42 | 56 |
43 PermissionStatus ShellPermissionManager::GetPermissionStatus( | 57 PermissionStatus ShellPermissionManager::GetPermissionStatus( |
44 PermissionType permission, | 58 PermissionType permission, |
(...skipping 14 matching lines...) Expand all Loading... | |
59 const GURL& embedding_origin, | 73 const GURL& embedding_origin, |
60 const base::Callback<void(PermissionStatus)>& callback) { | 74 const base::Callback<void(PermissionStatus)>& callback) { |
61 return -1; | 75 return -1; |
62 } | 76 } |
63 | 77 |
64 void ShellPermissionManager::UnsubscribePermissionStatusChange( | 78 void ShellPermissionManager::UnsubscribePermissionStatusChange( |
65 int subscription_id) { | 79 int subscription_id) { |
66 } | 80 } |
67 | 81 |
68 } // namespace content | 82 } // namespace content |
OLD | NEW |