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

Side by Side Diff: net/android/java/src/org/chromium/net/RegistrationPolicy.java

Issue 1358163004: [Android] Introduce RegistrationPolicy for NetworkChangeNotifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean-up and rebase Created 5 years, 2 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.net;
6
7 /**
8 * Abstract class for providing a policy regarding when the NetworkChangeNotifie r
9 * should listen for network changes.
10 */
11 public abstract class RegistrationPolicy {
pauljensen 2015/10/01 12:06:36 Can we move this to be a static subclass of Networ
timvolodine 2015/10/05 17:26:45 made it inner static to NCNAD and removed the List
12 private Listener mListener;
13
14 /**
15 * Listener is notified by the policy when it should start/stop listening to network changes.
16 */
17 public interface Listener {
18 // Notifies the listener to start listening to network changes.
19 void register();
20 // Notifies the listener tp stop listening to network changes.
21 void unregister();
22 }
23
24 protected RegistrationPolicy() {}
pauljensen 2015/10/01 12:06:37 why do we need a constructor?
timvolodine 2015/10/05 17:26:45 yup no need, removed. done.
25
26 protected final void notifyRegister() {
pauljensen 2015/10/01 12:06:36 Can we rename notifyRegister to register? ditto fo
pauljensen 2015/10/01 12:06:37 Please add a comments for these functions; they re
timvolodine 2015/10/05 17:26:45 Done.
timvolodine 2015/10/05 17:26:45 Done.
27 assert mListener != null;
28 mListener.register();
29 }
30
31 protected final void notifyUnregister() {
32 assert mListener != null;
33 mListener.unregister();
34 }
35
36 protected void init(Listener listener) {
37 mListener = listener;
pauljensen 2015/10/01 12:06:37 move this line of code to constructor and make thi
timvolodine 2015/10/05 17:26:45 we should be able to pass the registration policy
38 }
39
40 protected abstract void destroy();
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698