| 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 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
| 6 | 6 |
| 7 #include "content/public/browser/render_process_host.h" | 7 #include "content/public/browser/render_process_host.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/browser/user_metrics.h" | 9 #include "content/public/browser/user_metrics.h" |
| 10 #include "extensions/browser/api/extensions_api_client.h" | 10 #include "extensions/browser/api/extensions_api_client.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return webview::kInvalidPermissionRequestID; | 312 return webview::kInvalidPermissionRequestID; |
| 313 } | 313 } |
| 314 | 314 |
| 315 int request_id = next_permission_request_id_++; | 315 int request_id = next_permission_request_id_++; |
| 316 pending_permission_requests_[request_id] = | 316 pending_permission_requests_[request_id] = |
| 317 PermissionResponseInfo(callback, permission_type, allowed_by_default); | 317 PermissionResponseInfo(callback, permission_type, allowed_by_default); |
| 318 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy()); | 318 scoped_ptr<base::DictionaryValue> args(request_info.DeepCopy()); |
| 319 args->SetInteger(webview::kRequestId, request_id); | 319 args->SetInteger(webview::kRequestId, request_id); |
| 320 switch (permission_type) { | 320 switch (permission_type) { |
| 321 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { | 321 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { |
| 322 web_view_guest_->DispatchEventToEmbedder( | 322 web_view_guest_->DispatchEventToView( |
| 323 new GuestViewBase::Event(webview::kEventNewWindow, args.Pass())); | 323 new GuestViewBase::Event(webview::kEventNewWindow, args.Pass())); |
| 324 break; | 324 break; |
| 325 } | 325 } |
| 326 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { | 326 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { |
| 327 web_view_guest_->DispatchEventToEmbedder( | 327 web_view_guest_->DispatchEventToView( |
| 328 new GuestViewBase::Event(webview::kEventDialog, args.Pass())); | 328 new GuestViewBase::Event(webview::kEventDialog, args.Pass())); |
| 329 break; | 329 break; |
| 330 } | 330 } |
| 331 default: { | 331 default: { |
| 332 args->SetString(webview::kPermission, | 332 args->SetString(webview::kPermission, |
| 333 PermissionTypeToString(permission_type)); | 333 PermissionTypeToString(permission_type)); |
| 334 web_view_guest_->DispatchEventToEmbedder(new GuestViewBase::Event( | 334 web_view_guest_->DispatchEventToView(new GuestViewBase::Event( |
| 335 webview::kEventPermissionRequest, | 335 webview::kEventPermissionRequest, args.Pass())); |
| 336 args.Pass())); | |
| 337 break; | 336 break; |
| 338 } | 337 } |
| 339 } | 338 } |
| 340 return request_id; | 339 return request_id; |
| 341 } | 340 } |
| 342 | 341 |
| 343 WebViewPermissionHelper::SetPermissionResult | 342 WebViewPermissionHelper::SetPermissionResult |
| 344 WebViewPermissionHelper::SetPermission( | 343 WebViewPermissionHelper::SetPermission( |
| 345 int request_id, | 344 int request_id, |
| 346 PermissionResponseAction action, | 345 PermissionResponseAction action, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 bool allowed_by_default) | 386 bool allowed_by_default) |
| 388 : callback(callback), | 387 : callback(callback), |
| 389 permission_type(permission_type), | 388 permission_type(permission_type), |
| 390 allowed_by_default(allowed_by_default) { | 389 allowed_by_default(allowed_by_default) { |
| 391 } | 390 } |
| 392 | 391 |
| 393 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { | 392 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { |
| 394 } | 393 } |
| 395 | 394 |
| 396 } // namespace extensions | 395 } // namespace extensions |
| OLD | NEW |