| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |