Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/IsAllowedConnectionCallbackImpl.java

Issue 29678581: Issue 6000 - Rename "libadblockplus-android" (Closed)
Patch Set: addressed comments Created Jan. 29, 2018, 11:04 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/src/org/adblockplus/libadblockplus/android/IsAllowedConnectionCallbackImpl.java
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/IsAllowedConnectionCallbackImpl.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/IsAllowedConnectionCallbackImpl.java
deleted file mode 100644
index 161450ea566995f6e39350e66042684bf5fbcabc..0000000000000000000000000000000000000000
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/IsAllowedConnectionCallbackImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-present eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package org.adblockplus.libadblockplus.android;
-
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.util.Log;
-
-import org.adblockplus.libadblockplus.IsAllowedConnectionCallback;
-
-public class IsAllowedConnectionCallbackImpl implements IsAllowedConnectionCallback
-{
- private static final String TAG = Utils.getTag(IsAllowedConnectionCallbackImpl.class);
-
- private ConnectivityManager manager;
-
- public IsAllowedConnectionCallbackImpl(ConnectivityManager manager)
- {
- super();
- this.manager = manager;
- }
-
- @Override
- public boolean isConnectionAllowed(String connection)
- {
- Log.d(TAG, "Checking connection: " + connection);
-
- if (connection == null)
- {
- // required connection type is not specified - any works
- return true;
- }
-
- NetworkInfo info = manager.getActiveNetworkInfo();
- if (info == null || !info.isConnected())
- {
- // not connected
- return false;
- }
-
- ConnectionType connectionType = ConnectionType.findByValue(connection);
- if (connectionType == null)
- {
- Log.e(TAG, "Unknown connection type: " + connection);
- return false;
- }
-
- if (!connectionType.isRequiredConnection(manager))
- {
- Log.w(TAG, "Current connection type is not allowed for web requests");
- return false;
- }
-
- return true;
- }
-}

Powered by Google App Engine
This is Rietveld