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

Side by Side Diff: content/public/android/java/src/org/chromium/content_public/browser/InterfaceRegistrar.java

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.content_public.browser; 5 package org.chromium.content_public.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.services.service_manager.InterfaceRegistry; 9 import org.chromium.services.service_manager.InterfaceRegistry;
10 10
11 import java.util.ArrayList; 11 import java.util.ArrayList;
12 import java.util.List; 12 import java.util.List;
13 13
14 /** 14 /**
15 * A registrar for mojo interface implementations to provide to an InterfaceRegi stry. 15 * A registrar for mojo interface implementations to provide to an InterfaceRegi stry.
16 * 16 *
17 * @param <ParamType> the type of parameter to pass to the InterfaceRegistrar wh en adding its 17 * @param <ParamType> the type of parameter to pass to the InterfaceRegistrar wh en adding its
18 * interfaces to an InterfaceRegistry 18 * interfaces to an InterfaceRegistry
19 */ 19 */
20 public interface InterfaceRegistrar<ParamType> { 20 public interface InterfaceRegistrar<ParamType> {
21 /** Invoked to register interfaces on |registry|, parametrized by |paramValu e|. */ 21 /** Invoked to register interfaces on |registry|, parametrized by |paramValu e|. */
22 public void registerInterfaces(InterfaceRegistry registry, ParamType paramVa lue); 22 public void registerInterfaces(InterfaceRegistry registry, ParamType paramVa lue);
23 23
24 /** A registry of InterfaceRegistrars. */ 24 /** A registry of InterfaceRegistrars. */
25 public static class Registry<ParamType> { 25 public static class Registry<ParamType> {
26 private static Registry<Context> sContextRegistry = null; 26 private static Registry<Context> sContextRegistry;
27 private static Registry<WebContents> sWebContentsRegistry = null; 27 private static Registry<WebContents> sWebContentsRegistry;
28 28
29 private List<InterfaceRegistrar<ParamType>> mRegistrars = 29 private List<InterfaceRegistrar<ParamType>> mRegistrars =
30 new ArrayList<InterfaceRegistrar<ParamType>>(); 30 new ArrayList<InterfaceRegistrar<ParamType>>();
31 31
32 public static void applyContextRegistrars( 32 public static void applyContextRegistrars(
33 InterfaceRegistry interfaceRegistry, Context context) { 33 InterfaceRegistry interfaceRegistry, Context context) {
34 if (sContextRegistry == null) { 34 if (sContextRegistry == null) {
35 return; 35 return;
36 } 36 }
37 sContextRegistry.applyRegistrars(interfaceRegistry, context); 37 sContextRegistry.applyRegistrars(interfaceRegistry, context);
(...skipping 27 matching lines...) Expand all
65 mRegistrars.add(registrar); 65 mRegistrars.add(registrar);
66 } 66 }
67 67
68 private void applyRegistrars(InterfaceRegistry interfaceRegistry, ParamT ype param) { 68 private void applyRegistrars(InterfaceRegistry interfaceRegistry, ParamT ype param) {
69 for (InterfaceRegistrar<ParamType> registrar : mRegistrars) { 69 for (InterfaceRegistrar<ParamType> registrar : mRegistrars) {
70 registrar.registerInterfaces(interfaceRegistry, param); 70 registrar.registerInterfaces(interfaceRegistry, param);
71 } 71 }
72 } 72 }
73 } 73 }
74 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698