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 "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/public/browser/permission_type.h" | 9 #include "content/public/browser/permission_type.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 PermissionType permission, | 23 PermissionType permission, |
24 RenderFrameHost* render_frame_host, | 24 RenderFrameHost* render_frame_host, |
25 const GURL& requesting_origin, | 25 const GURL& requesting_origin, |
26 bool user_gesture, | 26 bool user_gesture, |
27 const base::Callback<void(PermissionStatus)>& callback) { | 27 const base::Callback<void(PermissionStatus)>& callback) { |
28 callback.Run(permission == PermissionType::GEOLOCATION | 28 callback.Run(permission == PermissionType::GEOLOCATION |
29 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); | 29 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); |
30 return kNoPendingOperation; | 30 return kNoPendingOperation; |
31 } | 31 } |
32 | 32 |
| 33 int ShellPermissionManager::RequestPermissions( |
| 34 const std::vector<PermissionType>& permissions, |
| 35 content::RenderFrameHost* render_frame_host, |
| 36 const GURL& requesting_origin, |
| 37 bool user_gesture, |
| 38 const base::Callback<void( |
| 39 const std::vector<PermissionStatus>&)>& callback) { |
| 40 std::vector<PermissionStatus> result(permissions.size()); |
| 41 for (const auto& permission : permissions) { |
| 42 result.push_back(permission == PermissionType::GEOLOCATION |
| 43 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); |
| 44 } |
| 45 callback.Run(result); |
| 46 return kNoPendingOperation; |
| 47 } |
| 48 |
33 void ShellPermissionManager::CancelPermissionRequest(int request_id) { | 49 void ShellPermissionManager::CancelPermissionRequest(int request_id) { |
34 } | 50 } |
35 | 51 |
36 void ShellPermissionManager::ResetPermission( | 52 void ShellPermissionManager::ResetPermission( |
37 PermissionType permission, | 53 PermissionType permission, |
38 const GURL& requesting_origin, | 54 const GURL& requesting_origin, |
39 const GURL& embedding_origin) { | 55 const GURL& embedding_origin) { |
40 } | 56 } |
41 | 57 |
42 PermissionStatus ShellPermissionManager::GetPermissionStatus( | 58 PermissionStatus ShellPermissionManager::GetPermissionStatus( |
(...skipping 22 matching lines...) Expand all Loading... |
65 const GURL& embedding_origin, | 81 const GURL& embedding_origin, |
66 const base::Callback<void(PermissionStatus)>& callback) { | 82 const base::Callback<void(PermissionStatus)>& callback) { |
67 return kNoPendingOperation; | 83 return kNoPendingOperation; |
68 } | 84 } |
69 | 85 |
70 void ShellPermissionManager::UnsubscribePermissionStatusChange( | 86 void ShellPermissionManager::UnsubscribePermissionStatusChange( |
71 int subscription_id) { | 87 int subscription_id) { |
72 } | 88 } |
73 | 89 |
74 } // namespace content | 90 } // namespace content |
OLD | NEW |