| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 | 331 |
| 332 int request_id = next_permission_request_id_++; | 332 int request_id = next_permission_request_id_++; |
| 333 pending_permission_requests_[request_id] = | 333 pending_permission_requests_[request_id] = |
| 334 PermissionResponseInfo(callback, permission_type, allowed_by_default); | 334 PermissionResponseInfo(callback, permission_type, allowed_by_default); |
| 335 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 335 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 336 args->Set(webview::kRequestInfo, request_info.DeepCopy()); | 336 args->Set(webview::kRequestInfo, request_info.DeepCopy()); |
| 337 args->SetInteger(webview::kRequestId, request_id); | 337 args->SetInteger(webview::kRequestId, request_id); |
| 338 switch (permission_type) { | 338 switch (permission_type) { |
| 339 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { | 339 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { |
| 340 web_view_guest_->DispatchEventToView(base::WrapUnique( | 340 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
| 341 new GuestViewEvent(webview::kEventNewWindow, std::move(args)))); | 341 webview::kEventNewWindow, std::move(args))); |
| 342 break; | 342 break; |
| 343 } | 343 } |
| 344 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { | 344 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { |
| 345 web_view_guest_->DispatchEventToView(base::WrapUnique( | 345 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
| 346 new GuestViewEvent(webview::kEventDialog, std::move(args)))); | 346 webview::kEventDialog, std::move(args))); |
| 347 break; | 347 break; |
| 348 } | 348 } |
| 349 default: { | 349 default: { |
| 350 args->SetString(webview::kPermission, | 350 args->SetString(webview::kPermission, |
| 351 PermissionTypeToString(permission_type)); | 351 PermissionTypeToString(permission_type)); |
| 352 web_view_guest_->DispatchEventToView(base::WrapUnique(new GuestViewEvent( | 352 web_view_guest_->DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
| 353 webview::kEventPermissionRequest, std::move(args)))); | 353 webview::kEventPermissionRequest, std::move(args))); |
| 354 break; | 354 break; |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 return request_id; | 357 return request_id; |
| 358 } | 358 } |
| 359 | 359 |
| 360 WebViewPermissionHelper::SetPermissionResult | 360 WebViewPermissionHelper::SetPermissionResult |
| 361 WebViewPermissionHelper::SetPermission( | 361 WebViewPermissionHelper::SetPermission( |
| 362 int request_id, | 362 int request_id, |
| 363 PermissionResponseAction action, | 363 PermissionResponseAction action, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 allowed_by_default(allowed_by_default) { | 407 allowed_by_default(allowed_by_default) { |
| 408 } | 408 } |
| 409 | 409 |
| 410 WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( | 410 WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( |
| 411 const PermissionResponseInfo& other) = default; | 411 const PermissionResponseInfo& other) = default; |
| 412 | 412 |
| 413 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { | 413 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace extensions | 416 } // namespace extensions |
| OLD | NEW |