OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 ShowGeolocationPromptHelper(java_ref_, origin); | 484 ShowGeolocationPromptHelper(java_ref_, origin); |
485 } | 485 } |
486 } | 486 } |
487 | 487 |
488 // Invoked from Java | 488 // Invoked from Java |
489 void AwContents::InvokeGeolocationCallback(JNIEnv* env, | 489 void AwContents::InvokeGeolocationCallback(JNIEnv* env, |
490 jobject obj, | 490 jobject obj, |
491 jboolean value, | 491 jboolean value, |
492 jstring origin) { | 492 jstring origin) { |
493 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 493 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
494 if (pending_geolocation_prompts_.empty()) { | 494 if (pending_geolocation_prompts_.empty()) |
495 LOG(WARNING) << "Response for this geolocation request has been received." | |
496 << " Ignoring subsequent responses"; | |
497 return; | 495 return; |
498 } | |
499 | 496 |
500 GURL callback_origin(base::android::ConvertJavaStringToUTF16(env, origin)); | 497 GURL callback_origin(base::android::ConvertJavaStringToUTF16(env, origin)); |
501 if (callback_origin.GetOrigin() == | 498 if (callback_origin.GetOrigin() == |
502 pending_geolocation_prompts_.front().first) { | 499 pending_geolocation_prompts_.front().first) { |
503 pending_geolocation_prompts_.front().second.Run(value); | 500 pending_geolocation_prompts_.front().second.Run(value); |
504 pending_geolocation_prompts_.pop_front(); | 501 pending_geolocation_prompts_.pop_front(); |
505 if (!pending_geolocation_prompts_.empty()) { | 502 if (!pending_geolocation_prompts_.empty()) { |
506 ShowGeolocationPromptHelper(java_ref_, | 503 ShowGeolocationPromptHelper(java_ref_, |
507 pending_geolocation_prompts_.front().first); | 504 pending_geolocation_prompts_.front().first); |
508 } | 505 } |
509 } else { | |
510 LOG(WARNING) << "Response for this geolocation request has been received." | |
511 << " Ignoring subsequent responses"; | |
512 } | 506 } |
513 } | 507 } |
514 | 508 |
515 void AwContents::HideGeolocationPrompt(const GURL& origin) { | 509 void AwContents::HideGeolocationPrompt(const GURL& origin) { |
516 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 510 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
517 bool removed_current_outstanding_callback = false; | 511 bool removed_current_outstanding_callback = false; |
518 std::list<OriginCallback>::iterator it = pending_geolocation_prompts_.begin(); | 512 std::list<OriginCallback>::iterator it = pending_geolocation_prompts_.begin(); |
519 while (it != pending_geolocation_prompts_.end()) { | 513 while (it != pending_geolocation_prompts_.end()) { |
520 if ((*it).first == origin.GetOrigin()) { | 514 if ((*it).first == origin.GetOrigin()) { |
521 if (it == pending_geolocation_prompts_.begin()) { | 515 if (it == pending_geolocation_prompts_.begin()) { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 | 1191 |
1198 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, | 1192 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, |
1199 GetMessagePortMessageFilter()); | 1193 GetMessagePortMessageFilter()); |
1200 } | 1194 } |
1201 | 1195 |
1202 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1196 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1203 g_should_download_favicons = true; | 1197 g_should_download_favicons = true; |
1204 } | 1198 } |
1205 | 1199 |
1206 } // namespace android_webview | 1200 } // namespace android_webview |
OLD | NEW |