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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwBrowserContext.java

Issue 2611883002: Prepare to call GMS APIs from WebView (Closed)
Patch Set: explicit destructor for style checker Created 3 years, 11 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.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.AppWebMessagePortService; 10 import org.chromium.content.browser.AppWebMessagePortService;
11 import org.chromium.content.browser.ContentViewStatics; 11 import org.chromium.content.browser.ContentViewStatics;
12 12
13 /** 13 /**
14 * Java side of the Browser Context: contains all the java side objects needed t o host one 14 * Java side of the Browser Context: contains all the java side objects needed t o host one
15 * browing session (i.e. profile). 15 * browing session (i.e. profile).
16 * 16 *
17 * Note that historically WebView was running in single process mode, and limita tions on renderer 17 * Note that historically WebView was running in single process mode, and limita tions on renderer
18 * process only being able to use a single browser context, currently there can only be one 18 * process only being able to use a single browser context, currently there can only be one
19 * AwBrowserContext instance, so at this point the class mostly exists for conce ptual clarity. 19 * AwBrowserContext instance, so at this point the class mostly exists for conce ptual clarity.
20 */ 20 */
21 public class AwBrowserContext { 21 public class AwBrowserContext {
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 AppWebMessagePortService mMessagePortService; 26 private AppWebMessagePortService mMessagePortService;
27 private AwMetricsServiceClient mMetricsServiceClient;
28 private AwServiceWorkerController mServiceWorkerController; 27 private AwServiceWorkerController mServiceWorkerController;
29 private Context mApplicationContext; 28 private Context mApplicationContext;
30 29
31 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica tionContext) { 30 public AwBrowserContext(SharedPreferences sharedPreferences, Context applica tionContext) {
32 mSharedPreferences = sharedPreferences; 31 mSharedPreferences = sharedPreferences;
33 mMetricsServiceClient = new AwMetricsServiceClient(applicationContext);
34 mApplicationContext = applicationContext; 32 mApplicationContext = applicationContext;
35 } 33 }
36 34
37 public AwGeolocationPermissions getGeolocationPermissions() { 35 public AwGeolocationPermissions getGeolocationPermissions() {
38 if (mGeolocationPermissions == null) { 36 if (mGeolocationPermissions == null) {
39 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer ences); 37 mGeolocationPermissions = new AwGeolocationPermissions(mSharedPrefer ences);
40 } 38 }
41 return mGeolocationPermissions; 39 return mGeolocationPermissions;
42 } 40 }
43 41
44 public AwFormDatabase getFormDatabase() { 42 public AwFormDatabase getFormDatabase() {
45 if (mFormDatabase == null) { 43 if (mFormDatabase == null) {
46 mFormDatabase = new AwFormDatabase(); 44 mFormDatabase = new AwFormDatabase();
47 } 45 }
48 return mFormDatabase; 46 return mFormDatabase;
49 } 47 }
50 48
51 public AppWebMessagePortService getMessagePortService() { 49 public AppWebMessagePortService getMessagePortService() {
52 if (mMessagePortService == null) { 50 if (mMessagePortService == null) {
53 mMessagePortService = new AppWebMessagePortService(); 51 mMessagePortService = new AppWebMessagePortService();
54 } 52 }
55 return mMessagePortService; 53 return mMessagePortService;
56 } 54 }
57 55
58 public AwMetricsServiceClient getMetricsServiceClient() {
59 return mMetricsServiceClient;
60 }
61
62 public AwServiceWorkerController getServiceWorkerController() { 56 public AwServiceWorkerController getServiceWorkerController() {
63 if (mServiceWorkerController == null) { 57 if (mServiceWorkerController == null) {
64 mServiceWorkerController = new AwServiceWorkerController(mApplicatio nContext, this); 58 mServiceWorkerController = new AwServiceWorkerController(mApplicatio nContext, this);
65 } 59 }
66 return mServiceWorkerController; 60 return mServiceWorkerController;
67 } 61 }
68 62
69 /** 63 /**
70 * @see android.webkit.WebView#pauseTimers() 64 * @see android.webkit.WebView#pauseTimers()
71 */ 65 */
72 public void pauseTimers() { 66 public void pauseTimers() {
73 ContentViewStatics.setWebKitSharedTimersSuspended(true); 67 ContentViewStatics.setWebKitSharedTimersSuspended(true);
74 } 68 }
75 69
76 /** 70 /**
77 * @see android.webkit.WebView#resumeTimers() 71 * @see android.webkit.WebView#resumeTimers()
78 */ 72 */
79 public void resumeTimers() { 73 public void resumeTimers() {
80 ContentViewStatics.setWebKitSharedTimersSuspended(false); 74 ContentViewStatics.setWebKitSharedTimersSuspended(false);
81 } 75 }
82 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698