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

Side by Side Diff: chrome/browser/dom_distiller/tab_utils_android.cc

Issue 1391893003: NOT FOR REVIEW: Aura on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/dom_distiller/tab_utils_android.h" 5 #include "chrome/browser/dom_distiller/tab_utils_android.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/dom_distiller/tab_utils.h" 11 #include "chrome/browser/dom_distiller/tab_utils.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "components/url_formatter/url_formatter.h" 15 #include "components/url_formatter/url_formatter.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/common/content_constants.h" 17 #include "content/public/common/content_constants.h"
18 #include "jni/DomDistillerTabUtils_jni.h" 18 #include "jni/DomDistillerTabUtils_jni.h"
19 #include "net/base/net_util.h" 19 #include "net/base/net_util.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 namespace android { 22 namespace android {
23 23
24 void DistillCurrentPageAndView(JNIEnv* env, 24 void DistillCurrentPageAndView(JNIEnv* env,
25 jclass clazz, 25 jclass clazz,
26 jobject j_web_contents) { 26 jobject j_web_contents) {
27 #if !defined(USE_AURA)
27 content::WebContents* web_contents = 28 content::WebContents* web_contents =
28 content::WebContents::FromJavaWebContents(j_web_contents); 29 content::WebContents::FromJavaWebContents(j_web_contents);
29 ::DistillCurrentPageAndView(web_contents); 30 ::DistillCurrentPageAndView(web_contents);
31 #endif
30 } 32 }
31 33
32 void DistillAndView(JNIEnv* env, 34 void DistillAndView(JNIEnv* env,
33 jclass clazz, 35 jclass clazz,
34 jobject j_source_web_contents, 36 jobject j_source_web_contents,
35 jobject j_destination_web_contents) { 37 jobject j_destination_web_contents) {
38 #if !defined(USE_AURA)
36 content::WebContents* source_web_contents = 39 content::WebContents* source_web_contents =
37 content::WebContents::FromJavaWebContents(j_source_web_contents); 40 content::WebContents::FromJavaWebContents(j_source_web_contents);
38 content::WebContents* destination_web_contents = 41 content::WebContents* destination_web_contents =
39 content::WebContents::FromJavaWebContents(j_destination_web_contents); 42 content::WebContents::FromJavaWebContents(j_destination_web_contents);
40 ::DistillAndView(source_web_contents, destination_web_contents); 43 ::DistillAndView(source_web_contents, destination_web_contents);
44 #endif
41 } 45 }
42 46
43 jstring GetFormattedUrlFromOriginalDistillerUrl(JNIEnv* env, 47 jstring GetFormattedUrlFromOriginalDistillerUrl(JNIEnv* env,
44 jclass clazz, 48 jclass clazz,
45 jstring j_url) { 49 jstring j_url) {
46 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); 50 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url));
47 Profile* profile = ProfileManager::GetLastUsedProfile(); 51 Profile* profile = ProfileManager::GetLastUsedProfile();
48 std::string languages; // Empty if Profile cannot be retrieved. 52 std::string languages; // Empty if Profile cannot be retrieved.
49 if (profile) { 53 if (profile) {
50 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); 54 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
(...skipping 10 matching lines...) Expand all
61 url, languages, url_formatter::kFormatUrlOmitAll, 65 url, languages, url_formatter::kFormatUrlOmitAll,
62 net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr)) 66 net::UnescapeRule::NORMAL, nullptr, nullptr, nullptr))
63 .Release(); 67 .Release();
64 } 68 }
65 69
66 } // namespace android 70 } // namespace android
67 71
68 bool RegisterDomDistillerTabUtils(JNIEnv* env) { 72 bool RegisterDomDistillerTabUtils(JNIEnv* env) {
69 return android::RegisterNativesImpl(env); 73 return android::RegisterNativesImpl(env);
70 } 74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698