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

Side by Side Diff: components/dom_distiller/core/url_utils_android.cc

Issue 183893029: Add UI hook for distilling web pages for test shell (relanding) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DEPS after wrong rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « components/dom_distiller/core/url_utils_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/dom_distiller/core/url_utils_android.h"
6
7 #include <string>
8
9 #include "base/android/jni_string.h"
10 #include "components/dom_distiller/core/url_utils.h"
11 #include "jni/DomDistillerUrlUtils_jni.h"
12 #include "url/gurl.h"
13
14 namespace dom_distiller {
15
16 namespace url_utils {
17
18 namespace android {
19
20 jstring GetDistillerViewUrlFromUrl(JNIEnv* env,
21 jclass clazz,
22 jstring j_scheme,
23 jstring j_url) {
24 std::string scheme(base::android::ConvertJavaStringToUTF8(env, j_scheme));
25 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url));
26 if (!url.is_valid()) {
27 return NULL;
28 }
29 GURL view_url =
30 dom_distiller::url_utils::GetDistillerViewUrlFromUrl(scheme, url);
31 if (!view_url.is_valid()) {
32 return NULL;
33 }
34 return base::android::ConvertUTF8ToJavaString(env, view_url.spec()).Release();
35 }
36
37 bool RegisterUrlUtils(JNIEnv* env) { return RegisterNativesImpl(env); }
38
39 } // namespace android
40
41 } // namespace url_utils
42
43 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/url_utils_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698