Chromium Code Reviews| 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 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
| 9 | 9 |
| 10 import org.chromium.content.browser.ContentViewStatics; | 10 import org.chromium.content.browser.ContentViewStatics; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Java side of the Browser Context: contains all the java side objects needed t o host one | 13 * Java side of the Browser Context: contains all the java side objects needed t o host one |
| 14 * browing session (i.e. profile). | 14 * browing session (i.e. profile). |
| 15 * Note that due to running in single process mode, and limitations on renderer process only | 15 * Note that due to running in single process mode, and limitations on renderer process only |
| 16 * being able to use a single browser context, currently there can only be one A wBrowserContext | 16 * being able to use a single browser context, currently there can only be one A wBrowserContext |
| 17 * instance, so at this point the class mostly exists for conceptual clarity. | 17 * instance, so at this point the class mostly exists for conceptual clarity. |
| 18 */ | 18 */ |
| 19 public class AwBrowserContext { | 19 public class AwBrowserContext { |
| 20 private static final String HTTP_AUTH_DATABASE_FILE = "http_auth.db"; | 20 private static final String HTTP_AUTH_DATABASE_FILE = "http_auth.db"; |
| 21 | 21 |
| 22 private final SharedPreferences mSharedPreferences; | 22 private final SharedPreferences mSharedPreferences; |
| 23 private Context mApplicationContext; | |
|
sgurun-gerrit only
2015/12/11 00:06:45
drop
paulmiller
2015/12/18 00:15:49
fixed
| |
| 23 | 24 |
| 24 private AwGeolocationPermissions mGeolocationPermissions; | 25 private AwGeolocationPermissions mGeolocationPermissions; |
| 25 private AwFormDatabase mFormDatabase; | 26 private AwFormDatabase mFormDatabase; |
| 26 private HttpAuthDatabase mHttpAuthDatabase; | 27 private HttpAuthDatabase mHttpAuthDatabase; |
| 27 private AwMessagePortService mMessagePortService; | 28 private AwMessagePortService mMessagePortService; |
| 29 private AwMetricsServiceClient mMetricsServiceClient; | |
| 28 | 30 |
| 29 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica tionContext) { | 31 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica tionContext) { |
| 30 mSharedPreferences = sharedPreferences; | 32 mSharedPreferences = sharedPreferences; |
| 33 mApplicationContext = applicationContext; | |
|
sgurun-gerrit only
2015/12/11 00:06:45
drop
paulmiller
2015/12/18 00:15:49
fixed
| |
| 34 getMetricsServiceClient(); | |
|
sgurun-gerrit only
2015/12/11 00:06:45
do a
mMetricsServiceClient = new MetricsServiceCl
paulmiller
2015/12/18 00:15:49
fixed
| |
| 31 } | 35 } |
| 32 | 36 |
| 33 public AwGeolocationPermissions getGeolocationPermissions() { | 37 public AwGeolocationPermissions getGeolocationPermissions() { |
| 34 if (mGeolocationPermissions == null) { | 38 if (mGeolocationPermissions == null) { |
| 35 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer ences); | 39 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer ences); |
| 36 } | 40 } |
| 37 return mGeolocationPermissions; | 41 return mGeolocationPermissions; |
| 38 } | 42 } |
| 39 | 43 |
| 40 public AwFormDatabase getFormDatabase() { | 44 public AwFormDatabase getFormDatabase() { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 51 return mHttpAuthDatabase; | 55 return mHttpAuthDatabase; |
| 52 } | 56 } |
| 53 | 57 |
| 54 public AwMessagePortService getMessagePortService() { | 58 public AwMessagePortService getMessagePortService() { |
| 55 if (mMessagePortService == null) { | 59 if (mMessagePortService == null) { |
| 56 mMessagePortService = new AwMessagePortService(); | 60 mMessagePortService = new AwMessagePortService(); |
| 57 } | 61 } |
| 58 return mMessagePortService; | 62 return mMessagePortService; |
| 59 } | 63 } |
| 60 | 64 |
| 65 public AwMetricsServiceClient getMetricsServiceClient() { | |
| 66 if (mMetricsServiceClient == null) { | |
| 67 mMetricsServiceClient = new AwMetricsServiceClient(mApplicationConte xt); | |
| 68 } | |
| 69 return mMetricsServiceClient; | |
|
sgurun-gerrit only
2015/12/11 00:06:45
drop the if, simply return mMetricsServiceClient
paulmiller
2015/12/18 00:15:49
fixed
| |
| 70 } | |
| 71 | |
| 61 /** | 72 /** |
| 62 * @see android.webkit.WebView#pauseTimers() | 73 * @see android.webkit.WebView#pauseTimers() |
| 63 */ | 74 */ |
| 64 public void pauseTimers() { | 75 public void pauseTimers() { |
| 65 ContentViewStatics.setWebKitSharedTimersSuspended(true); | 76 ContentViewStatics.setWebKitSharedTimersSuspended(true); |
| 66 } | 77 } |
| 67 | 78 |
| 68 /** | 79 /** |
| 69 * @see android.webkit.WebView#resumeTimers() | 80 * @see android.webkit.WebView#resumeTimers() |
| 70 */ | 81 */ |
| 71 public void resumeTimers() { | 82 public void resumeTimers() { |
| 72 ContentViewStatics.setWebKitSharedTimersSuspended(false); | 83 ContentViewStatics.setWebKitSharedTimersSuspended(false); |
| 73 } | 84 } |
| 74 } | 85 } |
| OLD | NEW |