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

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

Issue 1058193002: Add support for not owning distilled WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issues. Created 5 years, 7 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"
(...skipping 10 matching lines...) Expand all
21 namespace android { 21 namespace android {
22 22
23 void DistillCurrentPageAndView(JNIEnv* env, 23 void DistillCurrentPageAndView(JNIEnv* env,
24 jclass clazz, 24 jclass clazz,
25 jobject j_web_contents) { 25 jobject j_web_contents) {
26 content::WebContents* web_contents = 26 content::WebContents* web_contents =
27 content::WebContents::FromJavaWebContents(j_web_contents); 27 content::WebContents::FromJavaWebContents(j_web_contents);
28 ::DistillCurrentPageAndView(web_contents); 28 ::DistillCurrentPageAndView(web_contents);
29 } 29 }
30 30
31 void DistillAndView(JNIEnv* env,
32 jclass clazz,
33 jobject j_source_web_contents,
34 jobject j_destination_web_contents) {
35 content::WebContents* source_web_contents =
36 content::WebContents::FromJavaWebContents(j_source_web_contents);
37 content::WebContents* destination_web_contents =
38 content::WebContents::FromJavaWebContents(j_destination_web_contents);
39 ::DistillAndView(source_web_contents, destination_web_contents);
40 }
41
31 jstring GetFormattedUrlFromOriginalDistillerUrl(JNIEnv* env, 42 jstring GetFormattedUrlFromOriginalDistillerUrl(JNIEnv* env,
32 jclass clazz, 43 jclass clazz,
33 jstring j_url) { 44 jstring j_url) {
34 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); 45 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url));
35 Profile* profile = ProfileManager::GetLastUsedProfile(); 46 Profile* profile = ProfileManager::GetLastUsedProfile();
36 std::string languages; // Empty if Profile cannot be retrieved. 47 std::string languages; // Empty if Profile cannot be retrieved.
37 if (profile) { 48 if (profile) {
38 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); 49 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
39 } 50 }
40 51
(...skipping 12 matching lines...) Expand all
53 NULL, 64 NULL,
54 NULL, 65 NULL,
55 NULL)).Release(); 66 NULL)).Release();
56 } 67 }
57 68
58 } // namespace android 69 } // namespace android
59 70
60 bool RegisterDomDistillerTabUtils(JNIEnv* env) { 71 bool RegisterDomDistillerTabUtils(JNIEnv* env) {
61 return android::RegisterNativesImpl(env); 72 return android::RegisterNativesImpl(env);
62 } 73 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_distiller/tab_utils.cc ('k') | chrome/browser/dom_distiller/tab_utils_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698