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 * | 15 * |
16 * Note that historically WebView was running in single process mode, and limita
tions on renderer | 16 * Note that historically WebView was running in single process mode, and limita
tions on renderer |
17 * process only being able to use a single browser context, currently there can
only be one | 17 * process only being able to use a single browser context, currently there can
only be one |
18 * AwBrowserContext instance, so at this point the class mostly exists for conce
ptual clarity. | 18 * AwBrowserContext instance, so at this point the class mostly exists for conce
ptual clarity. |
19 */ | 19 */ |
20 public class AwBrowserContext { | 20 public class AwBrowserContext { |
21 private static final String HTTP_AUTH_DATABASE_FILE = "http_auth.db"; | 21 private static final String HTTP_AUTH_DATABASE_FILE = "http_auth.db"; |
22 | 22 |
23 private final SharedPreferences mSharedPreferences; | 23 private final SharedPreferences mSharedPreferences; |
24 | 24 |
25 private AwGeolocationPermissions mGeolocationPermissions; | 25 private AwGeolocationPermissions mGeolocationPermissions; |
26 private AwFormDatabase mFormDatabase; | 26 private AwFormDatabase mFormDatabase; |
27 private HttpAuthDatabase mHttpAuthDatabase; | 27 private HttpAuthDatabase mHttpAuthDatabase; |
28 private AwMessagePortService mMessagePortService; | 28 private AwMessagePortService mMessagePortService; |
| 29 private AwMetricsServiceClient mMetricsServiceClient; |
29 | 30 |
30 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica
tionContext) { | 31 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica
tionContext) { |
31 mSharedPreferences = sharedPreferences; | 32 mSharedPreferences = sharedPreferences; |
| 33 mMetricsServiceClient = new AwMetricsServiceClient(applicationContext); |
32 } | 34 } |
33 | 35 |
34 public AwGeolocationPermissions getGeolocationPermissions() { | 36 public AwGeolocationPermissions getGeolocationPermissions() { |
35 if (mGeolocationPermissions == null) { | 37 if (mGeolocationPermissions == null) { |
36 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer
ences); | 38 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer
ences); |
37 } | 39 } |
38 return mGeolocationPermissions; | 40 return mGeolocationPermissions; |
39 } | 41 } |
40 | 42 |
41 public AwFormDatabase getFormDatabase() { | 43 public AwFormDatabase getFormDatabase() { |
(...skipping 10 matching lines...) Expand all Loading... |
52 return mHttpAuthDatabase; | 54 return mHttpAuthDatabase; |
53 } | 55 } |
54 | 56 |
55 public AwMessagePortService getMessagePortService() { | 57 public AwMessagePortService getMessagePortService() { |
56 if (mMessagePortService == null) { | 58 if (mMessagePortService == null) { |
57 mMessagePortService = new AwMessagePortService(); | 59 mMessagePortService = new AwMessagePortService(); |
58 } | 60 } |
59 return mMessagePortService; | 61 return mMessagePortService; |
60 } | 62 } |
61 | 63 |
| 64 public AwMetricsServiceClient getMetricsServiceClient() { |
| 65 return mMetricsServiceClient; |
| 66 } |
| 67 |
62 /** | 68 /** |
63 * @see android.webkit.WebView#pauseTimers() | 69 * @see android.webkit.WebView#pauseTimers() |
64 */ | 70 */ |
65 public void pauseTimers() { | 71 public void pauseTimers() { |
66 ContentViewStatics.setWebKitSharedTimersSuspended(true); | 72 ContentViewStatics.setWebKitSharedTimersSuspended(true); |
67 } | 73 } |
68 | 74 |
69 /** | 75 /** |
70 * @see android.webkit.WebView#resumeTimers() | 76 * @see android.webkit.WebView#resumeTimers() |
71 */ | 77 */ |
72 public void resumeTimers() { | 78 public void resumeTimers() { |
73 ContentViewStatics.setWebKitSharedTimersSuspended(false); | 79 ContentViewStatics.setWebKitSharedTimersSuspended(false); |
74 } | 80 } |
75 } | 81 } |
OLD | NEW |