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

Side by Side Diff: content/shell/browser/shell_permission_manager.cc

Issue 1316863010: browser: implement multiple permission requesting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@request-multiple-content
Patch Set: Rebase on master 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
« no previous file with comments | « content/shell/browser/shell_permission_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 int ShellPermissionManager::RequestPermission( 19 int ShellPermissionManager::RequestPermission(
20 PermissionType permission, 20 PermissionType permission,
21 RenderFrameHost* render_frame_host, 21 RenderFrameHost* render_frame_host,
22 const GURL& requesting_origin, 22 const GURL& requesting_origin,
23 bool user_gesture, 23 bool user_gesture,
24 const base::Callback<void(PermissionStatus)>& callback) { 24 const base::Callback<void(PermissionStatus)>& callback) {
25 callback.Run(permission == PermissionType::GEOLOCATION 25 callback.Run(permission == PermissionType::GEOLOCATION
26 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); 26 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED);
27 return kNoPendingOperation; 27 return kNoPendingOperation;
28 } 28 }
29 29
30 void ShellPermissionManager::CancelPermissionRequest( 30 int ShellPermissionManager::RequestPermissions(
31 PermissionType permission, 31 const std::vector<PermissionType>& permissions,
32 RenderFrameHost* render_frame_host, 32 content::RenderFrameHost* render_frame_host,
33 int request_id, 33 const GURL& requesting_origin,
34 const GURL& requesting_origin) { 34 bool user_gesture,
35 const base::Callback<void(
36 const std::vector<PermissionStatus>&)>& callback) {
37 std::vector<PermissionStatus> result;
38 for (const auto& permission : permissions) {
39 result.push_back(permission == PermissionType::GEOLOCATION
40 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED);
41 }
42 callback.Run(result);
43 return kNoPendingOperation;
44 }
45
46 void ShellPermissionManager::CancelPermissionRequest(int request_id) {
35 } 47 }
36 48
37 void ShellPermissionManager::ResetPermission( 49 void ShellPermissionManager::ResetPermission(
38 PermissionType permission, 50 PermissionType permission,
39 const GURL& requesting_origin, 51 const GURL& requesting_origin,
40 const GURL& embedding_origin) { 52 const GURL& embedding_origin) {
41 } 53 }
42 54
43 PermissionStatus ShellPermissionManager::GetPermissionStatus( 55 PermissionStatus ShellPermissionManager::GetPermissionStatus(
44 PermissionType permission, 56 PermissionType permission,
(...skipping 14 matching lines...) Expand all
59 const GURL& embedding_origin, 71 const GURL& embedding_origin,
60 const base::Callback<void(PermissionStatus)>& callback) { 72 const base::Callback<void(PermissionStatus)>& callback) {
61 return kNoPendingOperation; 73 return kNoPendingOperation;
62 } 74 }
63 75
64 void ShellPermissionManager::UnsubscribePermissionStatusChange( 76 void ShellPermissionManager::UnsubscribePermissionStatusChange(
65 int subscription_id) { 77 int subscription_id) {
66 } 78 }
67 79
68 } // namespace content 80 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_permission_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698