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

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

Issue 1837243002: Reader Mode support for low-end devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: swipe triggers custom tab Created 4 years, 8 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 | « chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManagerDelegate.java ('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
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 "chrome/browser/dom_distiller/tab_utils.h" 10 #include "chrome/browser/dom_distiller/tab_utils.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "components/dom_distiller/core/experiments.h" 14 #include "components/dom_distiller/core/experiments.h"
15 #include "components/navigation_interception/intercept_navigation_delegate.h"
15 #include "components/prefs/pref_service.h" 16 #include "components/prefs/pref_service.h"
16 #include "components/url_formatter/url_formatter.h" 17 #include "components/url_formatter/url_formatter.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/content_constants.h" 19 #include "content/public/common/content_constants.h"
19 #include "jni/DomDistillerTabUtils_jni.h" 20 #include "jni/DomDistillerTabUtils_jni.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace android { 23 namespace android {
23 24
24 void DistillCurrentPageAndView(JNIEnv* env, 25 void DistillCurrentPageAndView(JNIEnv* env,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 66
66 // Returns true if the distiller experiment is set to use any heuristic other 67 // Returns true if the distiller experiment is set to use any heuristic other
67 // than "NONE". This is used to prevent the Reader Mode panel from loading 68 // than "NONE". This is used to prevent the Reader Mode panel from loading
68 // when it would otherwise never be shown. 69 // when it would otherwise never be shown.
69 jboolean IsDistillerHeuristicsEnabled(JNIEnv* env, 70 jboolean IsDistillerHeuristicsEnabled(JNIEnv* env,
70 const JavaParamRef<jclass>& clazz) { 71 const JavaParamRef<jclass>& clazz) {
71 return dom_distiller::GetDistillerHeuristicsType() 72 return dom_distiller::GetDistillerHeuristicsType()
72 != dom_distiller::DistillerHeuristicsType::NONE; 73 != dom_distiller::DistillerHeuristicsType::NONE;
73 } 74 }
74 75
76 void SetInterceptNavigationDelegate(
77 JNIEnv* env,
78 const JavaParamRef<jclass>& clazz,
79 const JavaParamRef<jobject>& delegate,
80 const JavaParamRef<jobject>& j_web_contents) {
81 content::WebContents* web_contents =
82 content::WebContents::FromJavaWebContents(j_web_contents);
83 DCHECK(web_contents);
84 navigation_interception::InterceptNavigationDelegate::Associate(
85 web_contents,
86 make_scoped_ptr(new navigation_interception::InterceptNavigationDelegate(
87 env, delegate)));
88 }
89
75 } // namespace android 90 } // namespace android
76 91
77 bool RegisterDomDistillerTabUtils(JNIEnv* env) { 92 bool RegisterDomDistillerTabUtils(JNIEnv* env) {
78 return android::RegisterNativesImpl(env); 93 return android::RegisterNativesImpl(env);
79 } 94 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManagerDelegate.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698