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 "components/guest_view/browser/guest_view_event.h" | 9 #include "components/guest_view/browser/guest_view_event.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 327 } |
328 | 328 |
329 int request_id = next_permission_request_id_++; | 329 int request_id = next_permission_request_id_++; |
330 pending_permission_requests_[request_id] = | 330 pending_permission_requests_[request_id] = |
331 PermissionResponseInfo(callback, permission_type, allowed_by_default); | 331 PermissionResponseInfo(callback, permission_type, allowed_by_default); |
332 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 332 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
333 args->Set(webview::kRequestInfo, request_info.DeepCopy()); | 333 args->Set(webview::kRequestInfo, request_info.DeepCopy()); |
334 args->SetInteger(webview::kRequestId, request_id); | 334 args->SetInteger(webview::kRequestId, request_id); |
335 switch (permission_type) { | 335 switch (permission_type) { |
336 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { | 336 case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { |
337 web_view_guest_->DispatchEventToView( | 337 web_view_guest_->DispatchEventToView(make_scoped_ptr( |
338 new GuestViewEvent(webview::kEventNewWindow, std::move(args))); | 338 new GuestViewEvent(webview::kEventNewWindow, std::move(args)))); |
339 break; | 339 break; |
340 } | 340 } |
341 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { | 341 case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { |
342 web_view_guest_->DispatchEventToView( | 342 web_view_guest_->DispatchEventToView(make_scoped_ptr( |
343 new GuestViewEvent(webview::kEventDialog, std::move(args))); | 343 new GuestViewEvent(webview::kEventDialog, std::move(args)))); |
344 break; | 344 break; |
345 } | 345 } |
346 default: { | 346 default: { |
347 args->SetString(webview::kPermission, | 347 args->SetString(webview::kPermission, |
348 PermissionTypeToString(permission_type)); | 348 PermissionTypeToString(permission_type)); |
349 web_view_guest_->DispatchEventToView(new GuestViewEvent( | 349 web_view_guest_->DispatchEventToView(make_scoped_ptr(new GuestViewEvent( |
350 webview::kEventPermissionRequest, std::move(args))); | 350 webview::kEventPermissionRequest, std::move(args)))); |
351 break; | 351 break; |
352 } | 352 } |
353 } | 353 } |
354 return request_id; | 354 return request_id; |
355 } | 355 } |
356 | 356 |
357 WebViewPermissionHelper::SetPermissionResult | 357 WebViewPermissionHelper::SetPermissionResult |
358 WebViewPermissionHelper::SetPermission( | 358 WebViewPermissionHelper::SetPermission( |
359 int request_id, | 359 int request_id, |
360 PermissionResponseAction action, | 360 PermissionResponseAction action, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 bool allowed_by_default) | 401 bool allowed_by_default) |
402 : callback(callback), | 402 : callback(callback), |
403 permission_type(permission_type), | 403 permission_type(permission_type), |
404 allowed_by_default(allowed_by_default) { | 404 allowed_by_default(allowed_by_default) { |
405 } | 405 } |
406 | 406 |
407 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { | 407 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { |
408 } | 408 } |
409 | 409 |
410 } // namespace extensions | 410 } // namespace extensions |
OLD | NEW |