OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 23 matching lines...) Expand all Loading... |
34 { | 34 { |
35 final Tab selectedTab = Tabs.getInstance().getSelectedTab(); | 35 final Tab selectedTab = Tabs.getInstance().getSelectedTab(); |
36 if (selectedTab == null) | 36 if (selectedTab == null) |
37 return; | 37 return; |
38 final String url = selectedTab.getURL(); | 38 final String url = selectedTab.getURL(); |
39 item.setEnabled(false); | 39 item.setEnabled(false); |
40 item.setChecked(true); | 40 item.setChecked(true); |
41 | 41 |
42 if (UrlUtils.isSchemeHttpOrHttps(url)) | 42 if (UrlUtils.isSchemeHttpOrHttps(url)) |
43 { | 43 { |
44 AddOnBridge.queryIsWebsiteWhitelisted(url, new AdblockPlusApiCallback() | 44 ExtensionBridge.queryIsWebsiteWhitelisted(url, new AdblockPlusApiCallback(
) |
45 { | 45 { |
46 @Override | 46 @Override |
47 public void onApiRequestSucceeded(GeckoBundle bundle) | 47 public void onApiRequestSucceeded(GeckoBundle bundle) |
48 { | 48 { |
49 final boolean whitelisted = bundle.getBoolean("value"); | 49 final boolean whitelisted = bundle.getBoolean("value"); |
50 ThreadUtils.postToUiThread(new Runnable() | 50 ThreadUtils.postToUiThread(new Runnable() |
51 { | 51 { |
52 @Override | 52 @Override |
53 public void run() | 53 public void run() |
54 { | 54 { |
(...skipping 12 matching lines...) Expand all Loading... |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 public static void updateCurrentTabWhitelisting(final MenuItem item) | 70 public static void updateCurrentTabWhitelisting(final MenuItem item) |
71 { | 71 { |
72 final Tab selectedTab = Tabs.getInstance().getSelectedTab(); | 72 final Tab selectedTab = Tabs.getInstance().getSelectedTab(); |
73 if (selectedTab == null) | 73 if (selectedTab == null) |
74 return; | 74 return; |
75 final String url = selectedTab.getURL(); | 75 final String url = selectedTab.getURL(); |
76 | 76 |
77 AddOnBridge.whitelistWebsite(url, item.isChecked(), new AdblockPlusApiCallba
ck() | 77 ExtensionBridge.whitelistWebsite(url, item.isChecked(), new AdblockPlusApiCa
llback() |
78 { | 78 { |
79 @Override | 79 @Override |
80 public void onApiRequestSucceeded(GeckoBundle bundle) | 80 public void onApiRequestSucceeded(GeckoBundle bundle) |
81 { | 81 { |
82 ThreadUtils.postToUiThread(new Runnable() | 82 ThreadUtils.postToUiThread(new Runnable() |
83 { | 83 { |
84 @Override | 84 @Override |
85 public void run() | 85 public void run() |
86 { | 86 { |
87 selectedTab.doReload(false); | 87 selectedTab.doReload(false); |
(...skipping 13 matching lines...) Expand all Loading... |
101 { | 101 { |
102 final String installer = context.getPackageManager().getInstallerPackageName
(context.getPackageName()); | 102 final String installer = context.getPackageManager().getInstallerPackageName
(context.getPackageName()); |
103 return "com.android.vending".equals(installer); | 103 return "com.android.vending".equals(installer); |
104 } | 104 } |
105 | 105 |
106 private BrowserAppUtils() | 106 private BrowserAppUtils() |
107 { | 107 { |
108 // Shouldn't be instantiated. | 108 // Shouldn't be instantiated. |
109 } | 109 } |
110 } | 110 } |
OLD | NEW |