| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/aw_content_browser_client.h" | 5 #include "android_webview/browser/aw_content_browser_client.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
| 8 #include "android_webview/browser/aw_browser_main_parts.h" | 8 #include "android_webview/browser/aw_browser_main_parts.h" |
| 9 #include "android_webview/browser/aw_browser_permission_request_delegate.h" | 9 #include "android_webview/browser/aw_browser_permission_request_delegate.h" |
| 10 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 10 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 const GURL& requesting_frame, | 385 const GURL& requesting_frame, |
| 386 bool user_gesture, | 386 bool user_gesture, |
| 387 const base::Callback<void(content::PermissionStatus)>& callback) { | 387 const base::Callback<void(content::PermissionStatus)>& callback) { |
| 388 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); | 388 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
| 389 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); | 389 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 390 GURL origin = requesting_frame.GetOrigin(); | 390 GURL origin = requesting_frame.GetOrigin(); |
| 391 AwBrowserPermissionRequestDelegate* delegate = | 391 AwBrowserPermissionRequestDelegate* delegate = |
| 392 AwBrowserPermissionRequestDelegate::FromID(render_process_id, | 392 AwBrowserPermissionRequestDelegate::FromID(render_process_id, |
| 393 render_view_id); | 393 render_view_id); |
| 394 switch (permission) { | 394 switch (permission) { |
| 395 case content::PERMISSION_GEOLOCATION: | 395 case content::PermissionType::GEOLOCATION: |
| 396 if (!delegate) { | 396 if (!delegate) { |
| 397 DVLOG(0) << "Dropping GeolocationPermission request"; | 397 DVLOG(0) << "Dropping GeolocationPermission request"; |
| 398 callback.Run(content::PERMISSION_STATUS_DENIED); | 398 callback.Run(content::PERMISSION_STATUS_DENIED); |
| 399 return; | 399 return; |
| 400 } | 400 } |
| 401 delegate->RequestGeolocationPermission( | 401 delegate->RequestGeolocationPermission( |
| 402 origin, base::Bind(&CallbackPermisisonStatusWrapper, callback)); | 402 origin, base::Bind(&CallbackPermisisonStatusWrapper, callback)); |
| 403 break; | 403 break; |
| 404 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: | 404 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 405 if (!delegate) { | 405 if (!delegate) { |
| 406 DVLOG(0) << "Dropping ProtectedMediaIdentifierPermission request"; | 406 DVLOG(0) << "Dropping ProtectedMediaIdentifierPermission request"; |
| 407 callback.Run(content::PERMISSION_STATUS_DENIED); | 407 callback.Run(content::PERMISSION_STATUS_DENIED); |
| 408 return; | 408 return; |
| 409 } | 409 } |
| 410 delegate->RequestProtectedMediaIdentifierPermission( | 410 delegate->RequestProtectedMediaIdentifierPermission( |
| 411 origin, base::Bind(&CallbackPermisisonStatusWrapper, callback)); | 411 origin, base::Bind(&CallbackPermisisonStatusWrapper, callback)); |
| 412 break; | 412 break; |
| 413 case content::PERMISSION_MIDI_SYSEX: | 413 case content::PermissionType::MIDI_SYSEX: |
| 414 case content::PERMISSION_NOTIFICATIONS: | 414 case content::PermissionType::NOTIFICATIONS: |
| 415 case content::PERMISSION_PUSH_MESSAGING: | 415 case content::PermissionType::PUSH_MESSAGING: |
| 416 NOTIMPLEMENTED() << "RequestPermission not implemented for " | 416 NOTIMPLEMENTED() << "RequestPermission not implemented for " |
| 417 << permission; | 417 << static_cast<int>(permission); |
| 418 break; | 418 break; |
| 419 case content::PERMISSION_NUM: | 419 case content::PermissionType::NUM: |
| 420 NOTREACHED() << "Invalid RequestPermission for " << permission; | 420 NOTREACHED() << "Invalid RequestPermission for " |
| 421 << static_cast<int>(permission); |
| 421 break; | 422 break; |
| 422 } | 423 } |
| 423 } | 424 } |
| 424 | 425 |
| 425 void AwContentBrowserClient::CancelPermissionRequest( | 426 void AwContentBrowserClient::CancelPermissionRequest( |
| 426 content::PermissionType permission, | 427 content::PermissionType permission, |
| 427 content::WebContents* web_contents, | 428 content::WebContents* web_contents, |
| 428 int bridge_id, | 429 int bridge_id, |
| 429 const GURL& origin) { | 430 const GURL& origin) { |
| 430 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); | 431 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
| 431 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); | 432 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 432 AwBrowserPermissionRequestDelegate* delegate = | 433 AwBrowserPermissionRequestDelegate* delegate = |
| 433 AwBrowserPermissionRequestDelegate::FromID(render_process_id, | 434 AwBrowserPermissionRequestDelegate::FromID(render_process_id, |
| 434 render_view_id); | 435 render_view_id); |
| 435 if (!delegate) | 436 if (!delegate) |
| 436 return; | 437 return; |
| 437 switch (permission) { | 438 switch (permission) { |
| 438 case content::PERMISSION_GEOLOCATION: | 439 case content::PermissionType::GEOLOCATION: |
| 439 delegate->CancelGeolocationPermissionRequests(origin); | 440 delegate->CancelGeolocationPermissionRequests(origin); |
| 440 break; | 441 break; |
| 441 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: | 442 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 442 delegate->CancelProtectedMediaIdentifierPermissionRequests(origin); | 443 delegate->CancelProtectedMediaIdentifierPermissionRequests(origin); |
| 443 break; | 444 break; |
| 444 case content::PERMISSION_MIDI_SYSEX: | 445 case content::PermissionType::MIDI_SYSEX: |
| 445 case content::PERMISSION_NOTIFICATIONS: | 446 case content::PermissionType::NOTIFICATIONS: |
| 446 case content::PERMISSION_PUSH_MESSAGING: | 447 case content::PermissionType::PUSH_MESSAGING: |
| 447 NOTIMPLEMENTED() << "CancelPermission not implemented for " << permission; | 448 NOTIMPLEMENTED() << "CancelPermission not implemented for " |
| 449 << static_cast<int>(permission); |
| 448 break; | 450 break; |
| 449 case content::PERMISSION_NUM: | 451 case content::PermissionType::NUM: |
| 450 NOTREACHED() << "Invalid CancelPermission for " << permission; | 452 NOTREACHED() << "Invalid CancelPermission for " |
| 453 << static_cast<int>(permission); |
| 451 break; | 454 break; |
| 452 } | 455 } |
| 453 } | 456 } |
| 454 | 457 |
| 455 bool AwContentBrowserClient::CanCreateWindow( | 458 bool AwContentBrowserClient::CanCreateWindow( |
| 456 const GURL& opener_url, | 459 const GURL& opener_url, |
| 457 const GURL& opener_top_level_frame_url, | 460 const GURL& opener_top_level_frame_url, |
| 458 const GURL& source_origin, | 461 const GURL& source_origin, |
| 459 WindowContainerType container_type, | 462 WindowContainerType container_type, |
| 460 const GURL& target_url, | 463 const GURL& target_url, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); | 557 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); |
| 555 } | 558 } |
| 556 #endif | 559 #endif |
| 557 | 560 |
| 558 content::DevToolsManagerDelegate* | 561 content::DevToolsManagerDelegate* |
| 559 AwContentBrowserClient::GetDevToolsManagerDelegate() { | 562 AwContentBrowserClient::GetDevToolsManagerDelegate() { |
| 560 return new AwDevToolsManagerDelegate(); | 563 return new AwDevToolsManagerDelegate(); |
| 561 } | 564 } |
| 562 | 565 |
| 563 } // namespace android_webview | 566 } // namespace android_webview |
| OLD | NEW |