| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 int render_process_id, | 143 int render_process_id, |
| 144 int render_view_id, | 144 int render_view_id, |
| 145 const GURL& origin) { | 145 const GURL& origin) { |
| 146 AwBrowserPermissionRequestDelegate* delegate = | 146 AwBrowserPermissionRequestDelegate* delegate = |
| 147 AwBrowserPermissionRequestDelegate::FromID(render_process_id, | 147 AwBrowserPermissionRequestDelegate::FromID(render_process_id, |
| 148 render_view_id); | 148 render_view_id); |
| 149 if (delegate) | 149 if (delegate) |
| 150 delegate->CancelProtectedMediaIdentifierPermissionRequests(origin); | 150 delegate->CancelProtectedMediaIdentifierPermissionRequests(origin); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void CancelGeolocationPermissionRequests( | |
| 154 int render_process_id, | |
| 155 int render_view_id, | |
| 156 const GURL& origin) { | |
| 157 AwBrowserPermissionRequestDelegate* delegate = | |
| 158 AwBrowserPermissionRequestDelegate::FromID(render_process_id, | |
| 159 render_view_id); | |
| 160 if (delegate) | |
| 161 delegate->CancelGeolocationPermissionRequests(origin); | |
| 162 } | |
| 163 | |
| 164 } // namespace | 153 } // namespace |
| 165 | 154 |
| 166 std::string AwContentBrowserClient::GetAcceptLangsImpl() { | 155 std::string AwContentBrowserClient::GetAcceptLangsImpl() { |
| 167 // Start with the currnet locale. | 156 // Start with the currnet locale. |
| 168 std::string langs = l10n_util::GetDefaultLocale(); | 157 std::string langs = l10n_util::GetDefaultLocale(); |
| 169 | 158 |
| 170 // If we're not en-US, add in en-US which will be | 159 // If we're not en-US, add in en-US which will be |
| 171 // used with a lower q-value. | 160 // used with a lower q-value. |
| 172 if (base::StringToLowerASCII(langs) != "en-us") { | 161 if (base::StringToLowerASCII(langs) != "en-us") { |
| 173 langs += ",en-US"; | 162 langs += ",en-US"; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 scoped_ptr<content::DesktopNotificationDelegate> delegate, | 400 scoped_ptr<content::DesktopNotificationDelegate> delegate, |
| 412 base::Closure* cancel_callback) { | 401 base::Closure* cancel_callback) { |
| 413 NOTREACHED() << "Android WebView does not support desktop notifications."; | 402 NOTREACHED() << "Android WebView does not support desktop notifications."; |
| 414 } | 403 } |
| 415 | 404 |
| 416 void AwContentBrowserClient::RequestGeolocationPermission( | 405 void AwContentBrowserClient::RequestGeolocationPermission( |
| 417 content::WebContents* web_contents, | 406 content::WebContents* web_contents, |
| 418 int bridge_id, | 407 int bridge_id, |
| 419 const GURL& requesting_frame, | 408 const GURL& requesting_frame, |
| 420 bool user_gesture, | 409 bool user_gesture, |
| 421 base::Callback<void(bool)> result_callback, | 410 const base::Callback<void(bool)>& result_callback) { |
| 422 base::Closure* cancel_callback) { | |
| 423 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); | 411 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
| 424 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); | 412 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 425 AwBrowserPermissionRequestDelegate* delegate = | 413 AwBrowserPermissionRequestDelegate* delegate = |
| 426 AwBrowserPermissionRequestDelegate::FromID(render_process_id, | 414 AwBrowserPermissionRequestDelegate::FromID(render_process_id, |
| 427 render_view_id); | 415 render_view_id); |
| 428 if (delegate == NULL) { | 416 if (delegate == NULL) { |
| 429 DVLOG(0) << "Dropping GeolocationPermission request"; | 417 DVLOG(0) << "Dropping GeolocationPermission request"; |
| 430 result_callback.Run(false); | 418 result_callback.Run(false); |
| 431 return; | 419 return; |
| 432 } | 420 } |
| 433 | 421 |
| 434 GURL origin = requesting_frame.GetOrigin(); | 422 GURL origin = requesting_frame.GetOrigin(); |
| 435 if (cancel_callback) { | |
| 436 *cancel_callback = base::Bind( | |
| 437 CancelGeolocationPermissionRequests, render_process_id, render_view_id, | |
| 438 origin); | |
| 439 } | |
| 440 delegate->RequestGeolocationPermission(origin, result_callback); | 423 delegate->RequestGeolocationPermission(origin, result_callback); |
| 441 } | 424 } |
| 442 | 425 |
| 426 void AwContentBrowserClient::CancelGeolocationPermissionRequest( |
| 427 content::WebContents* web_contents, |
| 428 int bridge_id, |
| 429 const GURL& requesting_frame) { |
| 430 int render_process_id = web_contents->GetRenderProcessHost()->GetID(); |
| 431 int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID(); |
| 432 AwBrowserPermissionRequestDelegate* delegate = |
| 433 AwBrowserPermissionRequestDelegate::FromID(render_process_id, |
| 434 render_view_id); |
| 435 if (delegate) |
| 436 delegate->CancelGeolocationPermissionRequests(requesting_frame); |
| 437 } |
| 438 |
| 443 void AwContentBrowserClient::RequestMidiSysExPermission( | 439 void AwContentBrowserClient::RequestMidiSysExPermission( |
| 444 content::WebContents* web_contents, | 440 content::WebContents* web_contents, |
| 445 int bridge_id, | 441 int bridge_id, |
| 446 const GURL& requesting_frame, | 442 const GURL& requesting_frame, |
| 447 bool user_gesture, | 443 bool user_gesture, |
| 448 base::Callback<void(bool)> result_callback, | 444 base::Callback<void(bool)> result_callback, |
| 449 base::Closure* cancel_callback) { | 445 base::Closure* cancel_callback) { |
| 450 // TODO(toyoshim): Android WebView is not supported yet. | 446 // TODO(toyoshim): Android WebView is not supported yet. |
| 451 // See http://crbug.com/339767. | 447 // See http://crbug.com/339767. |
| 452 result_callback.Run(false); | 448 result_callback.Run(false); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 570 |
| 575 #if defined(VIDEO_HOLE) | 571 #if defined(VIDEO_HOLE) |
| 576 content::ExternalVideoSurfaceContainer* | 572 content::ExternalVideoSurfaceContainer* |
| 577 AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( | 573 AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( |
| 578 content::WebContents* web_contents) { | 574 content::WebContents* web_contents) { |
| 579 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); | 575 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); |
| 580 } | 576 } |
| 581 #endif | 577 #endif |
| 582 | 578 |
| 583 } // namespace android_webview | 579 } // namespace android_webview |
| OLD | NEW |