Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / android / load_url_params.cc
blobd276622f55a7e1799567d470b3ce503048532fde
1 // Copyright (c) 2012 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.
5 #include "content/browser/android/load_url_params.h"
7 #include <jni.h>
9 #include "base/android/jni_string.h"
10 #include "content/public/browser/navigation_controller.h"
11 #include "content/public/common/url_constants.h"
12 #include "jni/LoadUrlParams_jni.h"
13 #include "url/gurl.h"
15 namespace {
17 using content::NavigationController;
19 void RegisterConstants(JNIEnv* env) {
20 Java_LoadUrlParams_initializeConstants(env,
21 NavigationController::LOAD_TYPE_DEFAULT,
22 NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST,
23 NavigationController::LOAD_TYPE_DATA,
24 NavigationController::UA_OVERRIDE_INHERIT,
25 NavigationController::UA_OVERRIDE_FALSE,
26 NavigationController::UA_OVERRIDE_TRUE);
29 } // namespace
31 namespace content {
33 bool RegisterLoadUrlParams(JNIEnv* env) {
34 if (!RegisterNativesImpl(env))
35 return false;
36 RegisterConstants(env);
37 return true;
40 jboolean IsDataScheme(JNIEnv* env, jclass clazz, jstring jurl) {
41 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl));
42 return url.SchemeIs(url::kDataScheme);
45 } // namespace content