Commit 71235c3f authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

[WebLayer] Fix bad code formatting

Somehow this code got committed without git cl format being run.

Change-Id: I85ded7a8e9a5ec6e9d31ad8af38669bc12b3a49a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894535
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Auto-Submit: Clark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711545}
parent fc9b7c38
...@@ -17,17 +17,16 @@ import org.chromium.weblayer_private.aidl.IRemoteFragment; ...@@ -17,17 +17,16 @@ import org.chromium.weblayer_private.aidl.IRemoteFragment;
import org.chromium.weblayer_private.aidl.IRemoteFragmentClient; import org.chromium.weblayer_private.aidl.IRemoteFragmentClient;
public class BrowserFragmentImpl extends RemoteFragmentImpl { public class BrowserFragmentImpl extends RemoteFragmentImpl {
private final ProfileImpl mProfile; private final ProfileImpl mProfile;
private BrowserFragmentControllerImpl mController; private BrowserFragmentControllerImpl mController;
private Context mContext; private Context mContext;
public BrowserFragmentImpl(ProfileManager profileManager, IRemoteFragmentClient client, public BrowserFragmentImpl(
Bundle fragmentArgs) { ProfileManager profileManager, IRemoteFragmentClient client, Bundle fragmentArgs) {
super(client); super(client);
mProfile = profileManager.getProfile(fragmentArgs.getString( mProfile =
BrowserFragmentArgs.PROFILE_PATH)); profileManager.getProfile(fragmentArgs.getString(BrowserFragmentArgs.PROFILE_PATH));
} }
@Override @Override
......
...@@ -46,8 +46,8 @@ public final class ProfileImpl extends IProfile.Stub { ...@@ -46,8 +46,8 @@ public final class ProfileImpl extends IProfile.Stub {
public void clearBrowsingData(@NonNull @BrowsingDataType int[] dataTypes, public void clearBrowsingData(@NonNull @BrowsingDataType int[] dataTypes,
@NonNull IObjectWrapper completionCallback) { @NonNull IObjectWrapper completionCallback) {
Runnable callback = ObjectWrapper.unwrap(completionCallback, Runnable.class); Runnable callback = ObjectWrapper.unwrap(completionCallback, Runnable.class);
ProfileImplJni.get().clearBrowsingData(mNativeProfile, mapBrowsingDataTypes(dataTypes), ProfileImplJni.get().clearBrowsingData(
callback); mNativeProfile, mapBrowsingDataTypes(dataTypes), callback);
} }
private static @ImplBrowsingDataType int[] mapBrowsingDataTypes( private static @ImplBrowsingDataType int[] mapBrowsingDataTypes(
...@@ -78,7 +78,7 @@ public final class ProfileImpl extends IProfile.Stub { ...@@ -78,7 +78,7 @@ public final class ProfileImpl extends IProfile.Stub {
interface Natives { interface Natives {
long createProfile(String path); long createProfile(String path);
void deleteProfile(long profile); void deleteProfile(long profile);
void clearBrowsingData(long nativeProfileImpl, @ImplBrowsingDataType int[] dataTypes, void clearBrowsingData(
Runnable callback); long nativeProfileImpl, @ImplBrowsingDataType int[] dataTypes, Runnable callback);
} }
} }
...@@ -132,11 +132,11 @@ public final class WebLayerImpl extends IWebLayer.Stub { ...@@ -132,11 +132,11 @@ public final class WebLayerImpl extends IWebLayer.Stub {
} }
@Override @Override
public IBrowserFragment createBrowserFragmentImpl(IRemoteFragmentClient fragmentClient, public IBrowserFragment createBrowserFragmentImpl(
IObjectWrapper fragmentArgs) { IRemoteFragmentClient fragmentClient, IObjectWrapper fragmentArgs) {
Bundle unwrappedArgs = ObjectWrapper.unwrap(fragmentArgs, Bundle.class); Bundle unwrappedArgs = ObjectWrapper.unwrap(fragmentArgs, Bundle.class);
BrowserFragmentImpl fragment = new BrowserFragmentImpl(mProfileManager, fragmentClient, BrowserFragmentImpl fragment =
unwrappedArgs); new BrowserFragmentImpl(mProfileManager, fragmentClient, unwrappedArgs);
return fragment.asIBrowserFragment(); return fragment.asIBrowserFragment();
} }
......
...@@ -5,6 +5,4 @@ ...@@ -5,6 +5,4 @@
package org.chromium.weblayer_private.aidl; package org.chromium.weblayer_private.aidl;
/** Keys for the Bundle of arguments with which BrowserFragments are created. */ /** Keys for the Bundle of arguments with which BrowserFragments are created. */
public interface BrowserFragmentArgs { public interface BrowserFragmentArgs { String PROFILE_PATH = "profile_path"; }
String PROFILE_PATH = "profile_path";
}
...@@ -43,7 +43,8 @@ class NavigationControllerImpl : public NavigationController, ...@@ -43,7 +43,8 @@ class NavigationControllerImpl : public NavigationController,
bool CanGoBack(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) { bool CanGoBack(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
return CanGoBack(); return CanGoBack();
} }
bool CanGoForward(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) { bool CanGoForward(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj) {
return CanGoForward(); return CanGoForward();
} }
void Reload(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) { void Reload(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "base/android/callback_android.h" #include "base/android/callback_android.h"
#include "base/android/jni_string.h"
#include "base/android/jni_array.h" #include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#include "weblayer/browser/java/jni/ProfileImpl_jni.h" #include "weblayer/browser/java/jni/ProfileImpl_jni.h"
#endif #endif
...@@ -248,7 +248,8 @@ static void JNI_ProfileImpl_DeleteProfile(JNIEnv* env, jlong profile) { ...@@ -248,7 +248,8 @@ static void JNI_ProfileImpl_DeleteProfile(JNIEnv* env, jlong profile) {
delete reinterpret_cast<ProfileImpl*>(profile); delete reinterpret_cast<ProfileImpl*>(profile);
} }
void ProfileImpl::ClearBrowsingData(JNIEnv* env, void ProfileImpl::ClearBrowsingData(
JNIEnv* env,
const base::android::JavaParamRef<jintArray>& j_data_types, const base::android::JavaParamRef<jintArray>& j_data_types,
const base::android::JavaRef<jobject>& j_callback) { const base::android::JavaRef<jobject>& j_callback) {
std::vector<int> data_type_ints; std::vector<int> data_type_ints;
...@@ -258,7 +259,8 @@ void ProfileImpl::ClearBrowsingData(JNIEnv* env, ...@@ -258,7 +259,8 @@ void ProfileImpl::ClearBrowsingData(JNIEnv* env,
for (int type : data_type_ints) { for (int type : data_type_ints) {
data_types.push_back(static_cast<BrowsingDataType>(type)); data_types.push_back(static_cast<BrowsingDataType>(type));
} }
ClearBrowsingData(data_types, ClearBrowsingData(
data_types,
base::BindOnce(base::android::RunRunnableAndroid, base::BindOnce(base::android::RunRunnableAndroid,
base::android::ScopedJavaGlobalRef<jobject>(j_callback))); base::android::ScopedJavaGlobalRef<jobject>(j_callback)));
} }
......
...@@ -33,10 +33,10 @@ class ProfileImpl : public Profile { ...@@ -33,10 +33,10 @@ class ProfileImpl : public Profile {
base::OnceCallback<void()> callback) override; base::OnceCallback<void()> callback) override;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
ProfileImpl(JNIEnv* env, ProfileImpl(JNIEnv* env, const base::android::JavaParamRef<jstring>& path);
const base::android::JavaParamRef<jstring>& path);
void ClearBrowsingData(JNIEnv* env, void ClearBrowsingData(
JNIEnv* env,
const base::android::JavaParamRef<jintArray>& j_data_types, const base::android::JavaParamRef<jintArray>& j_data_types,
const base::android::JavaRef<jobject>& j_callback); const base::android::JavaRef<jobject>& j_callback);
#endif #endif
......
...@@ -86,8 +86,7 @@ public final class BrowserFragmentController { ...@@ -86,8 +86,7 @@ public final class BrowserFragmentController {
ThreadCheck.ensureOnUiThread(); ThreadCheck.ensureOnUiThread();
try { try {
final ListenableResult<Boolean> listenableResult = new ListenableResult<Boolean>(); final ListenableResult<Boolean> listenableResult = new ListenableResult<Boolean>();
mImpl.setSupportsEmbedding( mImpl.setSupportsEmbedding(enable, ObjectWrapper.wrap(new ValueCallback<Boolean>() {
enable, ObjectWrapper.wrap(new ValueCallback<Boolean>() {
@Override @Override
public void onReceiveValue(Boolean result) { public void onReceiveValue(Boolean result) {
listenableResult.supplyResult(result); listenableResult.supplyResult(result);
......
...@@ -74,8 +74,8 @@ public final class Profile { ...@@ -74,8 +74,8 @@ public final class Profile {
ThreadCheck.ensureOnUiThread(); ThreadCheck.ensureOnUiThread();
try { try {
ListenableResult<Void> result = new ListenableResult<>(); ListenableResult<Void> result = new ListenableResult<>();
mImpl.clearBrowsingData(dataTypes, mImpl.clearBrowsingData(
ObjectWrapper.wrap((Runnable) () -> result.supplyResult(null))); dataTypes, ObjectWrapper.wrap((Runnable) () -> result.supplyResult(null)));
return result; return result;
} catch (RemoteException e) { } catch (RemoteException e) {
throw new APICallException(e); throw new APICallException(e);
......
...@@ -214,8 +214,8 @@ public final class WebLayer { ...@@ -214,8 +214,8 @@ public final class WebLayer {
/* package */ IBrowserFragment connectFragment( /* package */ IBrowserFragment connectFragment(
IRemoteFragmentClient remoteFragmentClient, Bundle fragmentArgs) { IRemoteFragmentClient remoteFragmentClient, Bundle fragmentArgs) {
try { try {
return mImpl.createBrowserFragmentImpl(remoteFragmentClient, return mImpl.createBrowserFragmentImpl(
ObjectWrapper.wrap(fragmentArgs)); remoteFragmentClient, ObjectWrapper.wrap(fragmentArgs));
} catch (RemoteException e) { } catch (RemoteException e) {
throw new APICallException(e); throw new APICallException(e);
} }
......
...@@ -79,10 +79,10 @@ public class DataClearingTest { ...@@ -79,10 +79,10 @@ public class DataClearingTest {
CountDownLatch latch = new CountDownLatch(2); CountDownLatch latch = new CountDownLatch(2);
runOnUiThreadBlocking(() -> { runOnUiThreadBlocking(() -> {
Profile profile = activity.getBrowserFragmentController().getProfile(); Profile profile = activity.getBrowserFragmentController().getProfile();
profile.clearBrowsingData(new int[] {COOKIES_AND_SITE_DATA}).addCallback( profile.clearBrowsingData(new int[] {COOKIES_AND_SITE_DATA})
(ignored) -> latch.countDown()); .addCallback((ignored) -> latch.countDown());
profile.clearBrowsingData(new int[] {CACHE}).addCallback( profile.clearBrowsingData(new int[] {CACHE})
(ignored) -> latch.countDown()); .addCallback((ignored) -> latch.countDown());
}); });
assertTrue(latch.await(3, TimeUnit.SECONDS)); assertTrue(latch.await(3, TimeUnit.SECONDS));
} }
...@@ -96,8 +96,7 @@ public class DataClearingTest { ...@@ -96,8 +96,7 @@ public class DataClearingTest {
runOnUiThreadBlocking(() -> { runOnUiThreadBlocking(() -> {
Profile profile = activity.getBrowserFragmentController().getProfile(); Profile profile = activity.getBrowserFragmentController().getProfile();
profile.clearBrowsingData(new int[] {COOKIES_AND_SITE_DATA}).addCallback((v1) -> { profile.clearBrowsingData(new int[] {COOKIES_AND_SITE_DATA}).addCallback((v1) -> {
profile.clearBrowsingData(new int[] {CACHE}).addCallback( profile.clearBrowsingData(new int[] {CACHE}).addCallback((v2) -> latch.countDown());
(v2) -> latch.countDown());
}); });
}); });
assertTrue(latch.await(3, TimeUnit.SECONDS)); assertTrue(latch.await(3, TimeUnit.SECONDS));
...@@ -127,8 +126,12 @@ public class DataClearingTest { ...@@ -127,8 +126,12 @@ public class DataClearingTest {
throws InterruptedException { throws InterruptedException {
InstrumentationActivity activity = mActivityTestRule.launchWithProfile(profileName); InstrumentationActivity activity = mActivityTestRule.launchWithProfile(profileName);
CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1);
runOnUiThreadBlocking(() -> activity.getBrowserFragmentController().getProfile() runOnUiThreadBlocking(() -> {
.clearBrowsingData(dataTypes).addCallback((ignored) -> latch.countDown())); activity.getBrowserFragmentController()
.getProfile()
.clearBrowsingData(dataTypes)
.addCallback((ignored) -> latch.countDown());
});
assertTrue(latch.await(3, TimeUnit.SECONDS)); assertTrue(latch.await(3, TimeUnit.SECONDS));
} }
} }
...@@ -230,9 +230,7 @@ public class NavigationTest { ...@@ -230,9 +230,7 @@ public class NavigationTest {
navigationController.goForward(); navigationController.goForward();
}); });
runOnUiThreadBlocking(() -> { runOnUiThreadBlocking(() -> { assertFalse(navigationController.canGoForward()); });
assertFalse(navigationController.canGoForward());
});
} }
@Test @Test
......
...@@ -35,7 +35,8 @@ public class RenderingTest { ...@@ -35,7 +35,8 @@ public class RenderingTest {
activity.getBrowserFragmentController().setSupportsEmbedding(true).addCallback( activity.getBrowserFragmentController().setSupportsEmbedding(true).addCallback(
(Boolean result) -> { (Boolean result) -> {
Assert.assertTrue(result); Assert.assertTrue(result);
activity.getBrowserFragmentController().setSupportsEmbedding(false) activity.getBrowserFragmentController()
.setSupportsEmbedding(false)
.addCallback((Boolean result2) -> { .addCallback((Boolean result2) -> {
Assert.assertTrue(result2); Assert.assertTrue(result2);
latch.countDown(); latch.countDown();
......
...@@ -113,8 +113,8 @@ public class WebLayerShellActivity extends FragmentActivity { ...@@ -113,8 +113,8 @@ public class WebLayerShellActivity extends FragmentActivity {
// If activity is re-created during process restart, FragmentManager attaches // If activity is re-created during process restart, FragmentManager attaches
// BrowserFragment immediately, resulting in synchronous init. By the time this line // BrowserFragment immediately, resulting in synchronous init. By the time this line
// executes, the synchronous init has already happened. // executes, the synchronous init has already happened.
WebLayer.create(getApplication()).addCallback(webLayer -> onWebLayerReady( WebLayer.create(getApplication())
savedInstanceState)); .addCallback(webLayer -> onWebLayerReady(savedInstanceState));
} catch (UnsupportedVersionException e) { } catch (UnsupportedVersionException e) {
throw new RuntimeException("Failed to initialize WebLayer", e); throw new RuntimeException("Failed to initialize WebLayer", e);
} }
...@@ -264,8 +264,8 @@ public class WebLayerShellActivity extends FragmentActivity { ...@@ -264,8 +264,8 @@ public class WebLayerShellActivity extends FragmentActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (mBrowserFragmentController != null) { if (mBrowserFragmentController != null) {
NavigationController controller = mBrowserFragmentController.getBrowserController() NavigationController controller =
.getNavigationController(); mBrowserFragmentController.getBrowserController().getNavigationController();
if (controller.canGoBack()) { if (controller.canGoBack()) {
controller.goBack(); controller.goBack();
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment