OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.chrome.browser.nfc; | 5 package org.chromium.chrome.browser.nfc; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.nfc.NdefMessage; | 8 import android.nfc.NdefMessage; |
9 import android.nfc.NdefRecord; | 9 import android.nfc.NdefRecord; |
10 import android.nfc.NfcAdapter.CreateNdefMessageCallback; | 10 import android.nfc.NfcAdapter.CreateNdefMessageCallback; |
11 import android.nfc.NfcAdapter.OnNdefPushCompleteCallback; | 11 import android.nfc.NfcAdapter.OnNdefPushCompleteCallback; |
12 import android.nfc.NfcEvent; | 12 import android.nfc.NfcEvent; |
13 import android.os.Build; | 13 import android.os.Build; |
14 import android.os.Handler; | 14 import android.os.Handler; |
15 import android.os.Looper; | 15 import android.os.Looper; |
16 import android.text.TextUtils; | 16 import android.text.TextUtils; |
17 import android.widget.Toast; | |
18 | 17 |
19 import org.chromium.base.ThreadUtils; | 18 import org.chromium.base.ThreadUtils; |
20 import org.chromium.base.metrics.RecordUserAction; | 19 import org.chromium.base.metrics.RecordUserAction; |
21 import org.chromium.chrome.R; | 20 import org.chromium.chrome.R; |
| 21 import org.chromium.ui.widget.Toast; |
22 | 22 |
23 import java.net.MalformedURLException; | 23 import java.net.MalformedURLException; |
24 import java.net.URL; | 24 import java.net.URL; |
25 import java.util.concurrent.Callable; | 25 import java.util.concurrent.Callable; |
26 import java.util.concurrent.ExecutionException; | 26 import java.util.concurrent.ExecutionException; |
27 import java.util.concurrent.TimeUnit; | 27 import java.util.concurrent.TimeUnit; |
28 import java.util.concurrent.TimeoutException; | 28 import java.util.concurrent.TimeoutException; |
29 | 29 |
30 /** | 30 /** |
31 * Beam callback that gets passed to Android to get triggered when devices are t
apped to | 31 * Beam callback that gets passed to Android to get triggered when devices are t
apped to |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 private static boolean isValidUrl(String url) { | 142 private static boolean isValidUrl(String url) { |
143 if (TextUtils.isEmpty(url)) return false; | 143 if (TextUtils.isEmpty(url)) return false; |
144 try { | 144 try { |
145 String urlProtocol = (new URL(url)).getProtocol(); | 145 String urlProtocol = (new URL(url)).getProtocol(); |
146 return urlProtocol.matches("http|https"); | 146 return urlProtocol.matches("http|https"); |
147 } catch (MalformedURLException e) { | 147 } catch (MalformedURLException e) { |
148 return false; | 148 return false; |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
OLD | NEW |