| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; |
| 7 import android.content.Context; | 8 import android.content.Context; |
| 8 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
| 9 import android.media.MediaMetadataRetriever; | 10 import android.media.MediaMetadataRetriever; |
| 10 import android.net.ConnectivityManager; | 11 import android.net.ConnectivityManager; |
| 11 import android.net.NetworkInfo; | 12 import android.net.NetworkInfo; |
| 12 import android.os.ParcelFileDescriptor; | 13 import android.os.ParcelFileDescriptor; |
| 13 import android.text.TextUtils; | 14 import android.text.TextUtils; |
| 14 import android.util.Log; | 15 import android.util.Log; |
| 15 | 16 |
| 16 import org.chromium.base.CalledByNative; | 17 import org.chromium.base.CalledByNative; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return null; | 354 return null; |
| 354 } | 355 } |
| 355 NetworkInfo info = mConnectivityManager.getActiveNetworkInfo(); | 356 NetworkInfo info = mConnectivityManager.getActiveNetworkInfo(); |
| 356 if (info == null) { | 357 if (info == null) { |
| 357 Log.d(TAG, "no active network"); | 358 Log.d(TAG, "no active network"); |
| 358 return null; | 359 return null; |
| 359 } | 360 } |
| 360 return info.getType(); | 361 return info.getType(); |
| 361 } | 362 } |
| 362 | 363 |
| 364 @SuppressLint("SdCardPath") |
| 363 private List<String> getRawAcceptableDirectories(Context context) { | 365 private List<String> getRawAcceptableDirectories(Context context) { |
| 364 List<String> result = new ArrayList<String>(); | 366 List<String> result = new ArrayList<String>(); |
| 365 result.add("/mnt/sdcard/"); | 367 result.add("/mnt/sdcard/"); |
| 366 result.add("/sdcard/"); | 368 result.add("/sdcard/"); |
| 367 result.add("/data/data/" + context.getPackageName() + "/cache/"); | 369 result.add("/data/data/" + context.getPackageName() + "/cache/"); |
| 368 return result; | 370 return result; |
| 369 } | 371 } |
| 370 | 372 |
| 371 private List<String> canonicalize(List<String> paths) { | 373 private List<String> canonicalize(List<String> paths) { |
| 372 List<String> result = new ArrayList<String>(paths.size()); | 374 List<String> result = new ArrayList<String>(paths.size()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 @VisibleForTesting | 412 @VisibleForTesting |
| 411 void configure(String path) { | 413 void configure(String path) { |
| 412 mRetriever.setDataSource(path); | 414 mRetriever.setDataSource(path); |
| 413 } | 415 } |
| 414 | 416 |
| 415 @VisibleForTesting | 417 @VisibleForTesting |
| 416 String extractMetadata(int key) { | 418 String extractMetadata(int key) { |
| 417 return mRetriever.extractMetadata(key); | 419 return mRetriever.extractMetadata(key); |
| 418 } | 420 } |
| 419 } | 421 } |
| OLD | NEW |