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