summaryrefslogtreecommitdiffstats
path: root/net/android
diff options
context:
space:
mode:
authorpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 21:15:35 +0000
committerpliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 21:15:35 +0000
commit87cc31ac886874ccebad28288558456dd40bfd81 (patch)
tree9d21a6c80b37d373618056a64a2980ef513c1901 /net/android
parentccabb7d44d5a9cf0f1dbff1c4ba5632b13295ff8 (diff)
downloadchromium_src-87cc31ac886874ccebad28288558456dd40bfd81.zip
chromium_src-87cc31ac886874ccebad28288558456dd40bfd81.tar.gz
chromium_src-87cc31ac886874ccebad28288558456dd40bfd81.tar.bz2
Merge 187928
> Use the main application context in NCNAutoDetect. > > The main activity context was used to initialize NCNAutoDetect from the > application side. This was causing some unnecessary complexity due to its > lifetime management. > > BUG=178185 > > Review URL: https://codereview.chromium.org/12811002 TBR=pliard@chromium.org Review URL: https://codereview.chromium.org/12647011 git-svn-id: svn://svn.chromium.org/chrome/branches/1410/src@188823 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/android')
-rw-r--r--net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java10
1 files changed, 2 insertions, 8 deletions
diff --git a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
index c544365..038cb31 100644
--- a/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
+++ b/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java
@@ -62,7 +62,7 @@ public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver
private final Observer mObserver;
- private Context mContext;
+ private final Context mContext;
private ConnectivityManagerDelegate mConnectivityManagerDelegate;
private boolean mRegistered;
private int mConnectionType;
@@ -76,7 +76,7 @@ public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver
public NetworkChangeNotifierAutoDetect(Observer observer, Context context) {
mObserver = observer;
- mContext = context;
+ mContext = context.getApplicationContext();
mConnectivityManagerDelegate = new ConnectivityManagerDelegate(context);
mConnectionType = getCurrentConnectionType();
ActivityStatus.registerStateListener(this);
@@ -165,12 +165,6 @@ public class NetworkChangeNotifierAutoDetect extends BroadcastReceiver
// ActivityStatus.StateListener
@Override
public void onActivityStateChange(int state) {
- Context context = ActivityStatus.getActivity();
- if (mContext != context && context != null) {
- // Note that |context| can be null during testing. In this case |mContext| should not be
- // overwritten.
- mContext = context;
- }
if (state == ActivityStatus.RESUMED) {
// Note that this also covers the case where the main activity is created. The CREATED
// event is always followed by the RESUMED event. This is a temporary "hack" until