| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // AwContents.onPrepareDrawGL; this cast must match the code there. | 84 // AwContents.onPrepareDrawGL; this cast must match the code there. |
| 85 reinterpret_cast<android_webview::BrowserViewRenderer*>(view_context)->DrawGL( | 85 reinterpret_cast<android_webview::BrowserViewRenderer*>(view_context)->DrawGL( |
| 86 draw_info); | 86 draw_info); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 namespace android_webview { | 90 namespace android_webview { |
| 91 | 91 |
| 92 namespace { | 92 namespace { |
| 93 | 93 |
| 94 bool g_should_download_favicons = false; |
| 95 |
| 94 JavaBrowserViewRendererHelper* java_renderer_helper() { | 96 JavaBrowserViewRendererHelper* java_renderer_helper() { |
| 95 return JavaBrowserViewRendererHelper::GetInstance(); | 97 return JavaBrowserViewRendererHelper::GetInstance(); |
| 96 } | 98 } |
| 97 | 99 |
| 98 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey; | 100 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey; |
| 99 | 101 |
| 100 class AwContentsUserData : public base::SupportsUserData::Data { | 102 class AwContentsUserData : public base::SupportsUserData::Data { |
| 101 public: | 103 public: |
| 102 AwContentsUserData(AwContents* ptr) : contents_(ptr) {} | 104 AwContentsUserData(AwContents* ptr) : contents_(ptr) {} |
| 103 | 105 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 bool finished) { | 548 bool finished) { |
| 547 JNIEnv* env = AttachCurrentThread(); | 549 JNIEnv* env = AttachCurrentThread(); |
| 548 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 550 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 549 if (obj.is_null()) | 551 if (obj.is_null()) |
| 550 return; | 552 return; |
| 551 | 553 |
| 552 Java_AwContents_onFindResultReceived( | 554 Java_AwContents_onFindResultReceived( |
| 553 env, obj.obj(), active_ordinal, match_count, finished); | 555 env, obj.obj(), active_ordinal, match_count, finished); |
| 554 } | 556 } |
| 555 | 557 |
| 558 bool AwContents::ShouldDownloadFavicon(const GURL& icon_url) { |
| 559 return g_should_download_favicons; |
| 560 } |
| 561 |
| 556 void AwContents::OnReceivedIcon(const GURL& icon_url, const SkBitmap& bitmap) { | 562 void AwContents::OnReceivedIcon(const GURL& icon_url, const SkBitmap& bitmap) { |
| 557 JNIEnv* env = AttachCurrentThread(); | 563 JNIEnv* env = AttachCurrentThread(); |
| 558 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 564 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 559 if (obj.is_null()) | 565 if (obj.is_null()) |
| 560 return; | 566 return; |
| 561 | 567 |
| 562 content::NavigationEntry* entry = | 568 content::NavigationEntry* entry = |
| 563 web_contents_->GetController().GetActiveEntry(); | 569 web_contents_->GetController().GetActiveEntry(); |
| 564 | 570 |
| 565 if (entry) { | 571 if (entry) { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 void AwContents::SetJsOnlineProperty(JNIEnv* env, | 901 void AwContents::SetJsOnlineProperty(JNIEnv* env, |
| 896 jobject obj, | 902 jobject obj, |
| 897 jboolean network_up) { | 903 jboolean network_up) { |
| 898 render_view_host_ext_->SetJsOnlineProperty(network_up); | 904 render_view_host_ext_->SetJsOnlineProperty(network_up); |
| 899 } | 905 } |
| 900 | 906 |
| 901 void AwContents::TrimMemory(JNIEnv* env, jobject obj, jint level) { | 907 void AwContents::TrimMemory(JNIEnv* env, jobject obj, jint level) { |
| 902 browser_view_renderer_->TrimMemory(level); | 908 browser_view_renderer_->TrimMemory(level); |
| 903 } | 909 } |
| 904 | 910 |
| 911 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 912 g_should_download_favicons = true; |
| 913 } |
| 914 |
| 905 } // namespace android_webview | 915 } // namespace android_webview |
| OLD | NEW |