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