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

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

Issue 1474483004: WebView Metrics client implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.android_webview;
6
7 import android.content.Context;
8 import android.webkit.ValueCallback;
9
10 import org.chromium.base.Log;
11
12 import java.lang.reflect.InvocationTargetException;
13
14 /**
15 * This class manages platform-specific services. (i.e. Google Services) The pla tform
16 * should extend this class and use this base class to fetch their specialized v ersion.
17 */
18 public class PlatformServiceBridge {
19 private static final String TAG = "PlatformServiceBrid-";
20 private static final String PLATFORM_SERVICE_BRIDGE =
21 "com.android.webview.chromium.PlatformServiceBridgeGoogle";
22
23 private static PlatformServiceBridge sInstance;
24
25 protected PlatformServiceBridge() {}
26
27 public static PlatformServiceBridge getInstance(Context applicationContext) {
28 if (sInstance != null) {
29 return sInstance;
30 }
31
32 // Try to get a specialized service bridge.
33 try {
34 Class<?> cls = Class.forName(PLATFORM_SERVICE_BRIDGE);
35 sInstance = (PlatformServiceBridge) cls.getDeclaredConstructor(Conte xt.class)
36 .newInstance(applicationContext);
37 return sInstance;
38 } catch (ClassNotFoundException e) {
39 // This is not an error; it just means this device doesn't have spec ialized services.
40 } catch (IllegalAccessException | IllegalArgumentException | Instantiati onException
41 | NoSuchMethodException e) {
42 Log.e(TAG, "Failed to get " + PLATFORM_SERVICE_BRIDGE + ": " + e);
43 } catch (InvocationTargetException e) {
44 Log.e(TAG, "Failed invocation to get " + PLATFORM_SERVICE_BRIDGE + " :", e.getCause());
45 }
46
47 // Otherwise, get the generic service bridge.
48 sInstance = new PlatformServiceBridge();
49 return sInstance;
50 }
51
52 public void setMetricsSettingListener(ValueCallback<Boolean> callback) {}
53 }
OLDNEW
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java ('k') | android_webview/native/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698