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