summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorsmaslo@chromium.org <smaslo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-28 18:23:24 +0000
committersmaslo@chromium.org <smaslo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-28 18:23:24 +0000
commit474a5a3f0a86af709cc79fc9a9eaa457f4fcc0db (patch)
treea3b4953da4ca6e7065a406763266e0e5777abc30 /components
parent8df4312574bfeab1f9de51617e17ad110a178c78 (diff)
downloadchromium_src-474a5a3f0a86af709cc79fc9a9eaa457f4fcc0db.zip
chromium_src-474a5a3f0a86af709cc79fc9a9eaa457f4fcc0db.tar.gz
chromium_src-474a5a3f0a86af709cc79fc9a9eaa457f4fcc0db.tar.bz2
Refactoring isUrlReportable to isDistilledPage
Refactored and renamed isUrlReportable to isDistilledPage. Also moved dom distiller url scheme constant from chrome to components. BUG= Review URL: https://codereview.chromium.org/413983008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java13
-rw-r--r--components/dom_distiller/core/url_constants.cc1
-rw-r--r--components/dom_distiller/core/url_constants.h1
-rw-r--r--components/dom_distiller/core/url_utils.cc4
-rw-r--r--components/dom_distiller/core/url_utils.h4
-rw-r--r--components/dom_distiller/core/url_utils_android.cc8
6 files changed, 18 insertions, 13 deletions
diff --git a/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java
index 60eda9e..9607f65 100644
--- a/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java
+++ b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java
@@ -36,11 +36,18 @@ public final class DomDistillerUrlUtils {
return nativeGetOriginalUrlFromDistillerUrl(url);
}
- public static boolean isUrlReportable(String scheme, String url) {
- return nativeIsUrlReportable(scheme, url);
+ /**
+ * Returns whether the url is for a distilled page.
+ *
+ * @param url The url of the page.
+ * @return whether the url is for a distilled page.
+ */
+ public static boolean isDistilledPage(String url) {
+ return nativeIsDistilledPage(url);
}
private static native String nativeGetDistillerViewUrlFromUrl(String scheme, String url);
private static native String nativeGetOriginalUrlFromDistillerUrl(String viewerUrl);
- private static native boolean nativeIsUrlReportable(String scheme, String url);
+ private static native boolean nativeIsDistilledPage(String url);
+
}
diff --git a/components/dom_distiller/core/url_constants.cc b/components/dom_distiller/core/url_constants.cc
index 4d94361..3e6809b 100644
--- a/components/dom_distiller/core/url_constants.cc
+++ b/components/dom_distiller/core/url_constants.cc
@@ -6,6 +6,7 @@
namespace dom_distiller {
+const char kDomDistillerScheme[] = "chrome-distiller";
const char kEntryIdKey[] = "entry_id";
const char kUrlKey[] = "url";
const char kViewerCssPath[] = "dom_distiller_viewer.css";
diff --git a/components/dom_distiller/core/url_constants.h b/components/dom_distiller/core/url_constants.h
index 71a8a8b..f9f745e 100644
--- a/components/dom_distiller/core/url_constants.h
+++ b/components/dom_distiller/core/url_constants.h
@@ -7,6 +7,7 @@
namespace dom_distiller {
+extern const char kDomDistillerScheme[];
extern const char kEntryIdKey[];
extern const char kUrlKey[];
extern const char kViewerCssPath[];
diff --git a/components/dom_distiller/core/url_utils.cc b/components/dom_distiller/core/url_utils.cc
index e1d9b3d..d5ca57d 100644
--- a/components/dom_distiller/core/url_utils.cc
+++ b/components/dom_distiller/core/url_utils.cc
@@ -47,8 +47,8 @@ bool IsUrlDistillable(const GURL& url) {
return url.is_valid() && url.SchemeIsHTTPOrHTTPS();
}
-bool IsUrlReportable(const std::string& scheme, const GURL& url) {
- return url.is_valid() && url.scheme() == scheme;
+bool IsDistilledPage(const GURL& url) {
+ return url.is_valid() && url.scheme() == kDomDistillerScheme;
}
} // namespace url_utils
diff --git a/components/dom_distiller/core/url_utils.h b/components/dom_distiller/core/url_utils.h
index 8202850..4dc73b3 100644
--- a/components/dom_distiller/core/url_utils.h
+++ b/components/dom_distiller/core/url_utils.h
@@ -28,8 +28,8 @@ std::string GetValueForKeyInUrlPathQuery(const std::string& path,
// Returns whether it should be possible to distill the given |url|.
bool IsUrlDistillable(const GURL& url);
-// Returns whether it should be possible to report the given |url|.
-bool IsUrlReportable(const std::string& scheme, const GURL& url);
+// Returns whether the given |url| is for a distilled page.
+bool IsDistilledPage(const GURL& url);
} // namespace url_utils
diff --git a/components/dom_distiller/core/url_utils_android.cc b/components/dom_distiller/core/url_utils_android.cc
index fcadd52..b71eee1 100644
--- a/components/dom_distiller/core/url_utils_android.cc
+++ b/components/dom_distiller/core/url_utils_android.cc
@@ -53,13 +53,9 @@ jstring GetOriginalUrlFromDistillerUrl(JNIEnv* env,
.Release();
}
-jboolean IsUrlReportable(JNIEnv* env,
- jclass clazz,
- jstring j_scheme,
- jstring j_url) {
- std::string scheme(base::android::ConvertJavaStringToUTF8(env, j_scheme));
+jboolean IsDistilledPage(JNIEnv* env, jclass clazz, jstring j_url) {
GURL url(base::android::ConvertJavaStringToUTF8(env, j_url));
- return dom_distiller::url_utils::IsUrlReportable(scheme, url);
+ return dom_distiller::url_utils::IsDistilledPage(url);
}
bool RegisterUrlUtils(JNIEnv* env) { return RegisterNativesImpl(env); }