Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: base/android/content_uri_utils.cc

Issue 75533002: Fix chrome upload with content uri (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/android/content_uri_utils.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
9 #include "base/platform_file.h"
10 #include "jni/ContentUriUtils_jni.h"
11
12 using base::android::ConvertUTF8ToJavaString;
13
14 namespace base {
15
16 bool RegisterContentUriUtils(JNIEnv* env) {
17 return RegisterNativesImpl(env);
18 }
19
20 bool ContentUriExists(const FilePath& content_uri) {
21 JNIEnv* env = base::android::AttachCurrentThread();
22 ScopedJavaLocalRef<jstring> j_uri =
23 ConvertUTF8ToJavaString(env, content_uri.value());
24 return Java_ContentUriUtils_contentUriExists(
25 env, base::android::GetApplicationContext(), j_uri.obj());
26 }
27
28 int OpenContentUriForRead(const FilePath& content_uri) {
29 JNIEnv* env = base::android::AttachCurrentThread();
30 ScopedJavaLocalRef<jstring> j_uri =
31 ConvertUTF8ToJavaString(env, content_uri.value());
32 jint fd = Java_ContentUriUtils_openContentUriForRead(
33 env, base::android::GetApplicationContext(), j_uri.obj());
34 if (fd < 0)
35 return base::kInvalidPlatformFileValue;
36 return fd;
37 }
38
39 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698