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" |
11 #include "media/base/media_switches.h" | 11 #include "media/base/media_switches.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 ShellPermissionManager::ShellPermissionManager() | 15 ShellPermissionManager::ShellPermissionManager() |
16 : PermissionManager() { | 16 : PermissionManager() { |
17 } | 17 } |
18 | 18 |
19 ShellPermissionManager::~ShellPermissionManager() { | 19 ShellPermissionManager::~ShellPermissionManager() { |
20 } | 20 } |
21 | 21 |
22 int ShellPermissionManager::RequestPermission( | 22 int ShellPermissionManager::RequestPermission( |
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(permission::Status)>& callback) { |
28 callback.Run(permission == PermissionType::GEOLOCATION | 28 callback.Run(permission == PermissionType::GEOLOCATION |
29 ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED); | 29 ? permission::STATUS_GRANTED |
| 30 : permission::STATUS_DENIED); |
30 return kNoPendingOperation; | 31 return kNoPendingOperation; |
31 } | 32 } |
32 | 33 |
33 void ShellPermissionManager::CancelPermissionRequest(int request_id) { | 34 void ShellPermissionManager::CancelPermissionRequest(int request_id) { |
34 } | 35 } |
35 | 36 |
36 void ShellPermissionManager::ResetPermission( | 37 void ShellPermissionManager::ResetPermission( |
37 PermissionType permission, | 38 PermissionType permission, |
38 const GURL& requesting_origin, | 39 const GURL& requesting_origin, |
39 const GURL& embedding_origin) { | 40 const GURL& embedding_origin) { |
40 } | 41 } |
41 | 42 |
42 PermissionStatus ShellPermissionManager::GetPermissionStatus( | 43 permission::Status ShellPermissionManager::GetPermissionStatus( |
43 PermissionType permission, | 44 PermissionType permission, |
44 const GURL& requesting_origin, | 45 const GURL& requesting_origin, |
45 const GURL& embedding_origin) { | 46 const GURL& embedding_origin) { |
46 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 47 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
47 if ((permission == PermissionType::AUDIO_CAPTURE || | 48 if ((permission == PermissionType::AUDIO_CAPTURE || |
48 permission == PermissionType::VIDEO_CAPTURE) && | 49 permission == PermissionType::VIDEO_CAPTURE) && |
49 command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream) && | 50 command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream) && |
50 command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) { | 51 command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) { |
51 return PERMISSION_STATUS_GRANTED; | 52 return permission::STATUS_GRANTED; |
52 } | 53 } |
53 return PERMISSION_STATUS_DENIED; | 54 return permission::STATUS_DENIED; |
54 } | 55 } |
55 | 56 |
56 void ShellPermissionManager::RegisterPermissionUsage( | 57 void ShellPermissionManager::RegisterPermissionUsage( |
57 PermissionType permission, | 58 PermissionType permission, |
58 const GURL& requesting_origin, | 59 const GURL& requesting_origin, |
59 const GURL& embedding_origin) { | 60 const GURL& embedding_origin) { |
60 } | 61 } |
61 | 62 |
62 int ShellPermissionManager::SubscribePermissionStatusChange( | 63 int ShellPermissionManager::SubscribePermissionStatusChange( |
63 PermissionType permission, | 64 PermissionType permission, |
64 const GURL& requesting_origin, | 65 const GURL& requesting_origin, |
65 const GURL& embedding_origin, | 66 const GURL& embedding_origin, |
66 const base::Callback<void(PermissionStatus)>& callback) { | 67 const base::Callback<void(permission::Status)>& callback) { |
67 return kNoPendingOperation; | 68 return kNoPendingOperation; |
68 } | 69 } |
69 | 70 |
70 void ShellPermissionManager::UnsubscribePermissionStatusChange( | 71 void ShellPermissionManager::UnsubscribePermissionStatusChange( |
71 int subscription_id) { | 72 int subscription_id) { |
72 } | 73 } |
73 | 74 |
74 } // namespace content | 75 } // namespace content |
OLD | NEW |