OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // |request_id|. | 128 // |request_id|. |
129 SetPermissionResult SetPermission(int request_id, | 129 SetPermissionResult SetPermission(int request_id, |
130 PermissionResponseAction action, | 130 PermissionResponseAction action, |
131 const std::string& user_input); | 131 const std::string& user_input); |
132 | 132 |
133 void CancelPendingPermissionRequest(int request_id); | 133 void CancelPendingPermissionRequest(int request_id); |
134 | 134 |
135 WebViewGuest* web_view_guest() { return web_view_guest_; } | 135 WebViewGuest* web_view_guest() { return web_view_guest_; } |
136 | 136 |
137 private: | 137 private: |
| 138 void OnMediaPermissionResponse(const content::MediaStreamRequest& request, |
| 139 const content::MediaResponseCallback& callback, |
| 140 bool allow, |
| 141 const std::string& user_input); |
| 142 |
138 #if defined(ENABLE_PLUGINS) | 143 #if defined(ENABLE_PLUGINS) |
139 // content::WebContentsObserver implementation. | 144 // content::WebContentsObserver implementation. |
140 virtual bool OnMessageReceived( | 145 virtual bool OnMessageReceived( |
141 const IPC::Message& message, | 146 const IPC::Message& message, |
142 content::RenderFrameHost* render_frame_host) OVERRIDE; | 147 content::RenderFrameHost* render_frame_host) OVERRIDE; |
143 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 148 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
144 #endif // defined(ENABLE_PLUGINS) | 149 #endif // defined(ENABLE_PLUGINS) |
145 | 150 |
146 // A counter to generate a unique request id for a permission request. | 151 // A counter to generate a unique request id for a permission request. |
147 // We only need the ids to be unique for a given WebViewGuest. | 152 // We only need the ids to be unique for a given WebViewGuest. |
148 int next_permission_request_id_; | 153 int next_permission_request_id_; |
149 | 154 |
150 WebViewPermissionHelper::RequestMap pending_permission_requests_; | 155 WebViewPermissionHelper::RequestMap pending_permission_requests_; |
151 | 156 |
152 scoped_ptr<WebViewPermissionHelperDelegate> | 157 scoped_ptr<WebViewPermissionHelperDelegate> |
153 web_view_permission_helper_delegate_; | 158 web_view_permission_helper_delegate_; |
154 | 159 |
155 WebViewGuest* const web_view_guest_; | 160 WebViewGuest* const web_view_guest_; |
156 | 161 |
157 base::WeakPtrFactory<WebViewPermissionHelper> weak_factory_; | 162 base::WeakPtrFactory<WebViewPermissionHelper> weak_factory_; |
158 | 163 |
159 DISALLOW_COPY_AND_ASSIGN(WebViewPermissionHelper); | 164 DISALLOW_COPY_AND_ASSIGN(WebViewPermissionHelper); |
160 }; | 165 }; |
161 | 166 |
162 } // namespace extensions | 167 } // namespace extensions |
163 | 168 |
164 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ | 169 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ |
OLD | NEW |