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 | 23 |
24 private AwGeolocationPermissions mGeolocationPermissions; | 24 private AwGeolocationPermissions mGeolocationPermissions; |
25 private AwFormDatabase mFormDatabase; | 25 private AwFormDatabase mFormDatabase; |
26 private HttpAuthDatabase mHttpAuthDatabase; | 26 private HttpAuthDatabase mHttpAuthDatabase; |
27 private AwMessagePortService mMessagePortService; | 27 private AwMessagePortService mMessagePortService; |
| 28 private AwMetricsServiceClient mMetricsServiceClient; |
28 | 29 |
29 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica
tionContext) { | 30 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica
tionContext) { |
30 mSharedPreferences = sharedPreferences; | 31 mSharedPreferences = sharedPreferences; |
| 32 mMetricsServiceClient = new AwMetricsServiceClient(applicationContext); |
31 } | 33 } |
32 | 34 |
33 public AwGeolocationPermissions getGeolocationPermissions() { | 35 public AwGeolocationPermissions getGeolocationPermissions() { |
34 if (mGeolocationPermissions == null) { | 36 if (mGeolocationPermissions == null) { |
35 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer
ences); | 37 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer
ences); |
36 } | 38 } |
37 return mGeolocationPermissions; | 39 return mGeolocationPermissions; |
38 } | 40 } |
39 | 41 |
40 public AwFormDatabase getFormDatabase() { | 42 public AwFormDatabase getFormDatabase() { |
(...skipping 10 matching lines...) Expand all Loading... |
51 return mHttpAuthDatabase; | 53 return mHttpAuthDatabase; |
52 } | 54 } |
53 | 55 |
54 public AwMessagePortService getMessagePortService() { | 56 public AwMessagePortService getMessagePortService() { |
55 if (mMessagePortService == null) { | 57 if (mMessagePortService == null) { |
56 mMessagePortService = new AwMessagePortService(); | 58 mMessagePortService = new AwMessagePortService(); |
57 } | 59 } |
58 return mMessagePortService; | 60 return mMessagePortService; |
59 } | 61 } |
60 | 62 |
| 63 public AwMetricsServiceClient getMetricsServiceClient() { |
| 64 return mMetricsServiceClient; |
| 65 } |
| 66 |
61 /** | 67 /** |
62 * @see android.webkit.WebView#pauseTimers() | 68 * @see android.webkit.WebView#pauseTimers() |
63 */ | 69 */ |
64 public void pauseTimers() { | 70 public void pauseTimers() { |
65 ContentViewStatics.setWebKitSharedTimersSuspended(true); | 71 ContentViewStatics.setWebKitSharedTimersSuspended(true); |
66 } | 72 } |
67 | 73 |
68 /** | 74 /** |
69 * @see android.webkit.WebView#resumeTimers() | 75 * @see android.webkit.WebView#resumeTimers() |
70 */ | 76 */ |
71 public void resumeTimers() { | 77 public void resumeTimers() { |
72 ContentViewStatics.setWebKitSharedTimersSuspended(false); | 78 ContentViewStatics.setWebKitSharedTimersSuspended(false); |
73 } | 79 } |
74 } | 80 } |
OLD | NEW |