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

Side by Side Diff: android/command_line_android.cc

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 months 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
« no previous file with comments | « android/build_info.h ('k') | android/field_trial_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/android/command_line_android.h" 5 #include "base/android/command_line_android.h"
6 6
7 #include "base/android/jni_array.h" 7 #include "base/android/jni_array.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 22 matching lines...) Expand all
33 33
34 static void Reset(JNIEnv* env, jclass clazz) { 34 static void Reset(JNIEnv* env, jclass clazz) {
35 CommandLine::Reset(); 35 CommandLine::Reset();
36 } 36 }
37 37
38 static jboolean HasSwitch(JNIEnv* env, jclass clazz, jstring jswitch) { 38 static jboolean HasSwitch(JNIEnv* env, jclass clazz, jstring jswitch) {
39 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch)); 39 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch));
40 return CommandLine::ForCurrentProcess()->HasSwitch(switch_string); 40 return CommandLine::ForCurrentProcess()->HasSwitch(switch_string);
41 } 41 }
42 42
43 static jstring GetSwitchValue(JNIEnv* env, jclass clazz, jstring jswitch) { 43 static ScopedJavaLocalRef<jstring> GetSwitchValue(JNIEnv* env,
44 jclass clazz,
45 jstring jswitch) {
44 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch)); 46 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch));
45 std::string value(CommandLine::ForCurrentProcess()->GetSwitchValueNative( 47 std::string value(CommandLine::ForCurrentProcess()->GetSwitchValueNative(
46 switch_string)); 48 switch_string));
47 if (value.empty()) 49 if (value.empty())
48 return 0; 50 return ScopedJavaLocalRef<jstring>();
49 // OK to release, JNI binding. 51 return ConvertUTF8ToJavaString(env, value);
50 return ConvertUTF8ToJavaString(env, value).Release();
51 } 52 }
52 53
53 static void AppendSwitch(JNIEnv* env, jclass clazz, jstring jswitch) { 54 static void AppendSwitch(JNIEnv* env, jclass clazz, jstring jswitch) {
54 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch)); 55 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch));
55 CommandLine::ForCurrentProcess()->AppendSwitch(switch_string); 56 CommandLine::ForCurrentProcess()->AppendSwitch(switch_string);
56 } 57 }
57 58
58 static void AppendSwitchWithValue(JNIEnv* env, jclass clazz, 59 static void AppendSwitchWithValue(JNIEnv* env, jclass clazz,
59 jstring jswitch, jstring jvalue) { 60 jstring jswitch, jstring jvalue) {
60 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch)); 61 std::string switch_string(ConvertJavaStringToUTF8(env, jswitch));
(...skipping 16 matching lines...) Expand all
77 CommandLine::Init(0, NULL); 78 CommandLine::Init(0, NULL);
78 AppendJavaStringArrayToCommandLine(env, array, true); 79 AppendJavaStringArrayToCommandLine(env, array, true);
79 } 80 }
80 81
81 bool RegisterCommandLine(JNIEnv* env) { 82 bool RegisterCommandLine(JNIEnv* env) {
82 return RegisterNativesImpl(env); 83 return RegisterNativesImpl(env);
83 } 84 }
84 85
85 } // namespace android 86 } // namespace android
86 } // namespace base 87 } // namespace base
OLDNEW
« no previous file with comments | « android/build_info.h ('k') | android/field_trial_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698