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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 | 59 |
60 void ShellPermissionManager::CancelPermissionRequest(int request_id) { | 60 void ShellPermissionManager::CancelPermissionRequest(int request_id) { |
61 } | 61 } |
62 | 62 |
63 void ShellPermissionManager::ResetPermission( | 63 void ShellPermissionManager::ResetPermission( |
64 PermissionType permission, | 64 PermissionType permission, |
65 const GURL& requesting_origin, | 65 const GURL& requesting_origin, |
66 const GURL& embedding_origin) { | 66 const GURL& embedding_origin) { |
67 } | 67 } |
68 | 68 |
69 blink::mojom::PermissionStatus ShellPermissionManager::GetPermissionStatus( | 69 blink::mojom::PermissionStatus |
70 ShellPermissionManager::GetPermissionStatusForFrame( | |
benwells
2017/05/31 01:48:10
Nit: This would be clearer if there was a private
raymes
2017/06/01 02:54:40
Done.
| |
70 PermissionType permission, | 71 PermissionType permission, |
71 const GURL& requesting_origin, | 72 content::RenderFrameHost* render_frame_host, |
72 const GURL& embedding_origin) { | 73 const GURL& requesting_origin) { |
73 // Background sync browser tests require permission to be granted by default. | 74 // Background sync browser tests require permission to be granted by default. |
74 // TODO(nsatragno): add a command line flag so that it's only granted for | 75 // TODO(nsatragno): add a command line flag so that it's only granted for |
75 // tests. | 76 // tests. |
76 if (permission == PermissionType::BACKGROUND_SYNC) | 77 if (permission == PermissionType::BACKGROUND_SYNC) |
77 return blink::mojom::PermissionStatus::GRANTED; | 78 return blink::mojom::PermissionStatus::GRANTED; |
78 | 79 |
79 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 80 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
80 if ((permission == PermissionType::AUDIO_CAPTURE || | 81 if ((permission == PermissionType::AUDIO_CAPTURE || |
81 permission == PermissionType::VIDEO_CAPTURE) && | 82 permission == PermissionType::VIDEO_CAPTURE) && |
82 command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream) && | 83 command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream) && |
83 command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) { | 84 command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) { |
84 return blink::mojom::PermissionStatus::GRANTED; | 85 return blink::mojom::PermissionStatus::GRANTED; |
85 } | 86 } |
86 return blink::mojom::PermissionStatus::DENIED; | 87 return blink::mojom::PermissionStatus::DENIED; |
87 } | 88 } |
88 | 89 |
90 blink::mojom::PermissionStatus | |
91 ShellPermissionManager::GetPermissionStatusForWorker( | |
92 PermissionType permission, | |
93 const GURL& requesting_origin) { | |
94 return GetPermissionStatusForFrame(permission, /*render_frame_host=*/nullptr, | |
benwells
2017/05/30 06:49:13
nit: is this a typical way of commenting nullptrs?
benwells
2017/05/31 01:48:10
(thanks for explaining offline)
| |
95 requesting_origin); | |
96 } | |
97 | |
89 int ShellPermissionManager::SubscribePermissionStatusChange( | 98 int ShellPermissionManager::SubscribePermissionStatusChange( |
90 PermissionType permission, | 99 PermissionType permission, |
91 const GURL& requesting_origin, | 100 const GURL& requesting_origin, |
92 const GURL& embedding_origin, | 101 const GURL& embedding_origin, |
93 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) { | 102 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) { |
94 return kNoPendingOperation; | 103 return kNoPendingOperation; |
95 } | 104 } |
96 | 105 |
97 void ShellPermissionManager::UnsubscribePermissionStatusChange( | 106 void ShellPermissionManager::UnsubscribePermissionStatusChange( |
98 int subscription_id) { | 107 int subscription_id) { |
99 } | 108 } |
100 | 109 |
101 } // namespace content | 110 } // namespace content |
OLD | NEW |