OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/web_contents/web_contents_android.h" | 5 #include "content/browser/web_contents/web_contents_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void WebContentsAndroid::InsertCSS( | 116 void WebContentsAndroid::InsertCSS( |
117 JNIEnv* env, jobject jobj, jstring jcss) { | 117 JNIEnv* env, jobject jobj, jstring jcss) { |
118 web_contents_->InsertCSS(base::android::ConvertJavaStringToUTF8(env, jcss)); | 118 web_contents_->InsertCSS(base::android::ConvertJavaStringToUTF8(env, jcss)); |
119 } | 119 } |
120 | 120 |
121 RenderWidgetHostViewAndroid* | 121 RenderWidgetHostViewAndroid* |
122 WebContentsAndroid::GetRenderWidgetHostViewAndroid() { | 122 WebContentsAndroid::GetRenderWidgetHostViewAndroid() { |
123 RenderWidgetHostView* rwhv = NULL; | 123 RenderWidgetHostView* rwhv = NULL; |
124 rwhv = web_contents_->GetRenderWidgetHostView(); | 124 rwhv = web_contents_->GetRenderWidgetHostView(); |
125 if (web_contents_->ShowingInterstitialPage()) { | 125 if (web_contents_->ShowingInterstitialPage()) { |
126 rwhv = static_cast<InterstitialPageImpl*>( | 126 rwhv = web_contents_->GetInterstitialPage() |
127 web_contents_->GetInterstitialPage())-> | 127 ->GetMainFrame() |
128 GetRenderViewHost()->GetView(); | 128 ->GetRenderViewHost() |
| 129 ->GetView(); |
129 } | 130 } |
130 return static_cast<RenderWidgetHostViewAndroid*>(rwhv); | 131 return static_cast<RenderWidgetHostViewAndroid*>(rwhv); |
131 } | 132 } |
132 | 133 |
133 jint WebContentsAndroid::GetBackgroundColor(JNIEnv* env, jobject obj) { | 134 jint WebContentsAndroid::GetBackgroundColor(JNIEnv* env, jobject obj) { |
134 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); | 135 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); |
135 if (!rwhva) | 136 if (!rwhva) |
136 return SK_ColorWHITE; | 137 return SK_ColorWHITE; |
137 return rwhva->GetCachedBackgroundColor(); | 138 return rwhva->GetCachedBackgroundColor(); |
138 } | 139 } |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 ScopedJavaGlobalRef<jobject> j_callback; | 441 ScopedJavaGlobalRef<jobject> j_callback; |
441 j_callback.Reset(env, callback); | 442 j_callback.Reset(env, callback); |
442 content::RenderFrameHost::JavaScriptResultCallback js_callback = | 443 content::RenderFrameHost::JavaScriptResultCallback js_callback = |
443 base::Bind(&JavaScriptResultCallback, j_callback); | 444 base::Bind(&JavaScriptResultCallback, j_callback); |
444 | 445 |
445 web_contents_->GetMainFrame()->ExecuteJavaScript( | 446 web_contents_->GetMainFrame()->ExecuteJavaScript( |
446 ConvertJavaStringToUTF16(env, script), js_callback); | 447 ConvertJavaStringToUTF16(env, script), js_callback); |
447 } | 448 } |
448 | 449 |
449 } // namespace content | 450 } // namespace content |
OLD | NEW |