Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java

Issue 414423002: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed NavigationTransitionDelegate interface from ContentViewCore. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 package org.chromium.content.browser.webcontents; 5 package org.chromium.content.browser.webcontents;
6 6
7 import org.chromium.base.CalledByNative; 7 import org.chromium.base.CalledByNative;
8 import org.chromium.base.JNINamespace; 8 import org.chromium.base.JNINamespace;
9 import org.chromium.content_public.browser.NavigationController; 9 import org.chromium.content_public.browser.NavigationController;
10 import org.chromium.content_public.browser.NavigationTransitionDelegate;
10 import org.chromium.content_public.browser.WebContents; 11 import org.chromium.content_public.browser.WebContents;
11 12
12 /** 13 /**
13 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo ntentsImpl 14 * The WebContentsImpl Java wrapper to allow communicating with the native WebCo ntentsImpl
14 * object. 15 * object.
15 */ 16 */
16 @JNINamespace("content") 17 @JNINamespace("content")
17 //TODO(tedchoc): Remove the package restriction once this class moves to a non-p ublic content 18 //TODO(tedchoc): Remove the package restriction once this class moves to a non-p ublic content
18 // package whose visibility will be enforced via DEPS. 19 // package whose visibility will be enforced via DEPS.
19 /* package */ class WebContentsImpl implements WebContents { 20 /* package */ class WebContentsImpl implements WebContents {
20 21
21 private long mNativeWebContentsAndroid; 22 private long mNativeWebContentsAndroid;
22 private NavigationController mNavigationController; 23 private NavigationController mNavigationController;
23 24
25 private NavigationTransitionDelegate mNavigationTransitionDelegate = null;
26
24 private WebContentsImpl( 27 private WebContentsImpl(
25 long nativeWebContentsAndroid, NavigationController navigationContro ller) { 28 long nativeWebContentsAndroid, NavigationController navigationContro ller) {
26 mNativeWebContentsAndroid = nativeWebContentsAndroid; 29 mNativeWebContentsAndroid = nativeWebContentsAndroid;
27 mNavigationController = navigationController; 30 mNavigationController = navigationController;
28 } 31 }
29 32
30 @CalledByNative 33 @CalledByNative
31 private static WebContentsImpl create( 34 private static WebContentsImpl create(
32 long nativeWebContentsAndroid, NavigationController navigationContro ller) { 35 long nativeWebContentsAndroid, NavigationController navigationContro ller) {
33 return new WebContentsImpl(nativeWebContentsAndroid, navigationControlle r); 36 return new WebContentsImpl(nativeWebContentsAndroid, navigationControlle r);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // more efficient to do it this way and sometimes fire an unnecessary me ssage rather 132 // more efficient to do it this way and sometimes fire an unnecessary me ssage rather
130 // than synchronize with the renderer and always have an additional mess age. 133 // than synchronize with the renderer and always have an additional mess age.
131 nativeScrollFocusedEditableNodeIntoView(mNativeWebContentsAndroid); 134 nativeScrollFocusedEditableNodeIntoView(mNativeWebContentsAndroid);
132 } 135 }
133 136
134 @Override 137 @Override
135 public void selectWordAroundCaret() { 138 public void selectWordAroundCaret() {
136 nativeSelectWordAroundCaret(mNativeWebContentsAndroid); 139 nativeSelectWordAroundCaret(mNativeWebContentsAndroid);
137 } 140 }
138 141
142 @Override
143 public String getUrl() {
144 return nativeGetURL(mNativeWebContentsAndroid);
145 }
146
147 @Override
148 public boolean isIncognito() {
149 return nativeIsIncognito(mNativeWebContentsAndroid);
150 }
151
152 @Override
153 public void resumeResponseDeferredAtStart() {
154 nativeResumeResponseDeferredAtStart(mNativeWebContentsAndroid);
155 }
156
157 @Override
158 public void setHasPendingNavigationTransitionForTesting() {
159 nativeSetHasPendingNavigationTransitionForTesting(mNativeWebContentsAnd roid);
160 }
161
162 @Override
163 public void setNavigationTransitionDelegate(NavigationTransitionDelegate del egate) {
164 mNavigationTransitionDelegate = delegate;
165 }
166
167 @CalledByNative
168 private void didDeferAfterResponseStarted(String enteringColor) {
169 if (mNavigationTransitionDelegate != null ) {
170 mNavigationTransitionDelegate.didDeferAfterResponseStarted(enteringC olor);
171 }
172 }
173
174 @CalledByNative
175 private boolean willHandleDeferAfterResponseStarted() {
176 if (mNavigationTransitionDelegate == null) return false;
177 return mNavigationTransitionDelegate.willHandleDeferAfterResponseStarted ();
178 }
179
180 @CalledByNative
181 private void addEnteringStylesheetToTransition(String stylesheet) {
182 if (mNavigationTransitionDelegate != null ) {
183 mNavigationTransitionDelegate.addEnteringStylesheetToTransition(styl esheet);
184 }
185 }
186
187 @CalledByNative
188 public void didStartNavigationTransitionForFrame(long frameId) {
189 if (mNavigationTransitionDelegate != null ) {
190 mNavigationTransitionDelegate.didStartNavigationTransitionForFrame(f rameId);
191 }
192 }
193
139 private native String nativeGetTitle(long nativeWebContentsAndroid); 194 private native String nativeGetTitle(long nativeWebContentsAndroid);
140 private native String nativeGetVisibleURL(long nativeWebContentsAndroid); 195 private native String nativeGetVisibleURL(long nativeWebContentsAndroid);
141 private native void nativeStop(long nativeWebContentsAndroid); 196 private native void nativeStop(long nativeWebContentsAndroid);
142 private native void nativeInsertCSS(long nativeWebContentsAndroid, String cs s); 197 private native void nativeInsertCSS(long nativeWebContentsAndroid, String cs s);
143 private native void nativeOnHide(long nativeWebContentsAndroid); 198 private native void nativeOnHide(long nativeWebContentsAndroid);
144 private native void nativeOnShow(long nativeWebContentsAndroid); 199 private native void nativeOnShow(long nativeWebContentsAndroid);
145 private native int nativeGetBackgroundColor(long nativeWebContentsAndroid); 200 private native int nativeGetBackgroundColor(long nativeWebContentsAndroid);
146 private native void nativeAddStyleSheetByURL(long nativeWebContentsAndroid, 201 private native void nativeAddStyleSheetByURL(long nativeWebContentsAndroid,
147 String url); 202 String url);
148 private native void nativeShowInterstitialPage(long nativeWebContentsAndroid , 203 private native void nativeShowInterstitialPage(long nativeWebContentsAndroid ,
149 String url, long nativeInterstitialPageDelegateAndroid); 204 String url, long nativeInterstitialPageDelegateAndroid);
150 private native boolean nativeIsShowingInterstitialPage(long nativeWebContent sAndroid); 205 private native boolean nativeIsShowingInterstitialPage(long nativeWebContent sAndroid);
151 private native boolean nativeIsRenderWidgetHostViewReady(long nativeWebConte ntsAndroid); 206 private native boolean nativeIsRenderWidgetHostViewReady(long nativeWebConte ntsAndroid);
152 private native void nativeExitFullscreen(long nativeWebContentsAndroid); 207 private native void nativeExitFullscreen(long nativeWebContentsAndroid);
153 private native void nativeUpdateTopControlsState(long nativeWebContentsAndro id, 208 private native void nativeUpdateTopControlsState(long nativeWebContentsAndro id,
154 boolean enableHiding, boolean enableShowing, boolean animate); 209 boolean enableHiding, boolean enableShowing, boolean animate);
155 private native void nativeShowImeIfNeeded(long nativeWebContentsAndroid); 210 private native void nativeShowImeIfNeeded(long nativeWebContentsAndroid);
156 private native void nativeScrollFocusedEditableNodeIntoView(long nativeWebCo ntentsAndroid); 211 private native void nativeScrollFocusedEditableNodeIntoView(long nativeWebCo ntentsAndroid);
157 private native void nativeSelectWordAroundCaret(long nativeWebContentsAndroi d); 212 private native void nativeSelectWordAroundCaret(long nativeWebContentsAndroi d);
213 private native String nativeGetURL(long nativeWebContentsAndroid);
214 private native boolean nativeIsIncognito(long nativeWebContentsAndroid);
215 private native void nativeResumeResponseDeferredAtStart(long nativeWebConten tsAndroid);
216 private native void nativeSetHasPendingNavigationTransitionForTesting(
217 long nativeWebContentsAndroid);
158 } 218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698