summaryrefslogtreecommitdiffstats
path: root/components/error_page
diff options
context:
space:
mode:
authortfarina <tfarina@chromium.org>2015-08-10 14:20:14 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-10 21:21:00 +0000
commit01832b64148786bb4fc69458693d1e7111a112ef (patch)
treeda21fffca27889e643eac03bdc756b841166e7d2 /components/error_page
parent0262e947b4d00e355b96e3406f4afee5dd371cb2 (diff)
downloadchromium_src-01832b64148786bb4fc69458693d1e7111a112ef.zip
chromium_src-01832b64148786bb4fc69458693d1e7111a112ef.tar.gz
chromium_src-01832b64148786bb4fc69458693d1e7111a112ef.tar.bz2
Move DNS functions from net_error_info.h into error_page namespace.
This was a TODO for hashimoto. The rest of the file will be moved into error_page in a separate CL. BUG=None R=mmenke@chromium.org,thestig@chromium.org Review URL: https://codereview.chromium.org/1277213003 Cr-Commit-Position: refs/heads/master@{#342699}
Diffstat (limited to 'components/error_page')
-rw-r--r--components/error_page/common/net_error_info.cc48
-rw-r--r--components/error_page/common/net_error_info.h10
-rw-r--r--components/error_page/renderer/net_error_helper_core.cc48
-rw-r--r--components/error_page/renderer/net_error_helper_core_unittest.cc5
4 files changed, 51 insertions, 60 deletions
diff --git a/components/error_page/common/net_error_info.cc b/components/error_page/common/net_error_info.cc
index 7483e73..0fd913b 100644
--- a/components/error_page/common/net_error_info.cc
+++ b/components/error_page/common/net_error_info.cc
@@ -7,40 +7,40 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
-namespace chrome_common_net {
+namespace error_page {
const char kDnsProbeErrorDomain[] = "dnsprobe";
const char* DnsProbeStatusToString(int status) {
switch (status) {
- case DNS_PROBE_POSSIBLE:
- return "DNS_PROBE_POSSIBLE";
- case DNS_PROBE_NOT_RUN:
- return "DNS_PROBE_NOT_RUN";
- case DNS_PROBE_STARTED:
- return "DNS_PROBE_STARTED";
- case DNS_PROBE_FINISHED_INCONCLUSIVE:
- return "DNS_PROBE_FINISHED_INCONCLUSIVE";
- case DNS_PROBE_FINISHED_NO_INTERNET:
- return "DNS_PROBE_FINISHED_NO_INTERNET";
- case DNS_PROBE_FINISHED_BAD_CONFIG:
- return "DNS_PROBE_FINISHED_BAD_CONFIG";
- case DNS_PROBE_FINISHED_NXDOMAIN:
- return "DNS_PROBE_FINISHED_NXDOMAIN";
- default:
- NOTREACHED();
- return "";
+ case chrome_common_net::DNS_PROBE_POSSIBLE:
+ return "DNS_PROBE_POSSIBLE";
+ case chrome_common_net::DNS_PROBE_NOT_RUN:
+ return "DNS_PROBE_NOT_RUN";
+ case chrome_common_net::DNS_PROBE_STARTED:
+ return "DNS_PROBE_STARTED";
+ case chrome_common_net::DNS_PROBE_FINISHED_INCONCLUSIVE:
+ return "DNS_PROBE_FINISHED_INCONCLUSIVE";
+ case chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET:
+ return "DNS_PROBE_FINISHED_NO_INTERNET";
+ case chrome_common_net::DNS_PROBE_FINISHED_BAD_CONFIG:
+ return "DNS_PROBE_FINISHED_BAD_CONFIG";
+ case chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN:
+ return "DNS_PROBE_FINISHED_NXDOMAIN";
+ default:
+ NOTREACHED();
+ return "";
}
}
-bool DnsProbeStatusIsFinished(DnsProbeStatus status) {
- return status >= DNS_PROBE_FINISHED_INCONCLUSIVE &&
- status < DNS_PROBE_MAX;
+bool DnsProbeStatusIsFinished(chrome_common_net::DnsProbeStatus status) {
+ return status >= chrome_common_net::DNS_PROBE_FINISHED_INCONCLUSIVE &&
+ status < chrome_common_net::DNS_PROBE_MAX;
}
-void RecordEvent(NetworkErrorPageEvent event) {
+void RecordEvent(chrome_common_net::NetworkErrorPageEvent event) {
UMA_HISTOGRAM_ENUMERATION("Net.ErrorPageCounts", event,
- NETWORK_ERROR_PAGE_EVENT_MAX);
+ chrome_common_net::NETWORK_ERROR_PAGE_EVENT_MAX);
}
-} // namespace chrome_common_net
+} // namespace error_page
diff --git a/components/error_page/common/net_error_info.h b/components/error_page/common/net_error_info.h
index f67c9b0..4ebd068 100644
--- a/components/error_page/common/net_error_info.h
+++ b/components/error_page/common/net_error_info.h
@@ -83,6 +83,10 @@ enum DnsProbeStatus {
DNS_PROBE_MAX
};
+} // namespace chrome_common_net
+
+namespace error_page {
+
// Returns a string representing |status|. It should be simply the name of
// the value as a string, but don't rely on that. This is presented to the
// user as part of the DNS error page (as the error code, at the bottom),
@@ -94,15 +98,15 @@ enum DnsProbeStatus {
const char* DnsProbeStatusToString(int status);
// Returns true if |status| is one of the DNS_PROBE_FINISHED_* statuses.
-bool DnsProbeStatusIsFinished(DnsProbeStatus status);
+bool DnsProbeStatusIsFinished(chrome_common_net::DnsProbeStatus status);
// Record specific error page events.
-void RecordEvent(NetworkErrorPageEvent event);
+void RecordEvent(chrome_common_net::NetworkErrorPageEvent event);
// The error domain used to pass DNS probe statuses to the localized error
// code.
extern const char kDnsProbeErrorDomain[];
-} // namespace chrome_common_net
+} // namespace error_page
#endif // COMPONENTS_ERROR_PAGE_COMMON_NET_ERROR_INFO_H_
diff --git a/components/error_page/renderer/net_error_helper_core.cc b/components/error_page/renderer/net_error_helper_core.cc
index e5f3dc3..da61080 100644
--- a/components/error_page/renderer/net_error_helper_core.cc
+++ b/components/error_page/renderer/net_error_helper_core.cc
@@ -570,10 +570,9 @@ void NetErrorHelperCore::OnCommitLoad(FrameType frame_type, const GURL& url) {
pending_error_page_info_->error.unreachableURL) {
DCHECK(navigation_from_button_ == RELOAD_BUTTON ||
navigation_from_button_ == SHOW_SAVED_COPY_BUTTON);
- chrome_common_net::RecordEvent(
- navigation_from_button_ == RELOAD_BUTTON ?
- chrome_common_net::NETWORK_ERROR_PAGE_RELOAD_BUTTON_ERROR :
- chrome_common_net::NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_ERROR);
+ RecordEvent(navigation_from_button_ == RELOAD_BUTTON ?
+ chrome_common_net::NETWORK_ERROR_PAGE_RELOAD_BUTTON_ERROR :
+ chrome_common_net::NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_ERROR);
}
navigation_from_button_ = NO_BUTTON;
@@ -601,26 +600,22 @@ void NetErrorHelperCore::OnFinishLoad(FrameType frame_type) {
committed_error_page_info_->is_finished_loading = true;
- chrome_common_net::RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_SHOWN);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_SHOWN);
if (committed_error_page_info_->reload_button_in_page) {
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_PAGE_RELOAD_BUTTON_SHOWN);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_RELOAD_BUTTON_SHOWN);
}
if (committed_error_page_info_->show_saved_copy_button_in_page) {
- chrome_common_net::RecordEvent(
+ RecordEvent(
chrome_common_net::NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_SHOWN);
}
if (committed_error_page_info_->reload_button_in_page &&
committed_error_page_info_->show_saved_copy_button_in_page) {
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN);
}
if (committed_error_page_info_->show_cached_copy_button_in_page) {
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_SHOWN);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_SHOWN);
} else if (committed_error_page_info_->show_cached_page_button_in_page) {
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_SHOWN);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_SHOWN);
}
delegate_->EnablePageHelperFunctions();
@@ -834,8 +829,7 @@ blink::WebURLError NetErrorHelperCore::GetUpdatedError(
}
blink::WebURLError updated_error;
- updated_error.domain = blink::WebString::fromUTF8(
- chrome_common_net::kDnsProbeErrorDomain);
+ updated_error.domain = blink::WebString::fromUTF8(kDnsProbeErrorDomain);
updated_error.reason = last_probe_status_;
updated_error.unreachableURL = error.unreachableURL;
updated_error.staleCopyInCache = error.staleCopyInCache;
@@ -963,21 +957,20 @@ void NetErrorHelperCore::ExecuteButtonPress(bool is_error_page, Button button) {
switch (button) {
case RELOAD_BUTTON:
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_PAGE_RELOAD_BUTTON_CLICKED);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_RELOAD_BUTTON_CLICKED);
if (committed_error_page_info_->show_saved_copy_button_in_page) {
- chrome_common_net::RecordEvent(
+ RecordEvent(
chrome_common_net::NETWORK_ERROR_PAGE_BOTH_BUTTONS_RELOAD_CLICKED);
}
navigation_from_button_ = RELOAD_BUTTON;
Reload();
return;
case SHOW_SAVED_COPY_BUTTON:
- chrome_common_net::RecordEvent(
+ RecordEvent(
chrome_common_net::NETWORK_ERROR_PAGE_SHOW_SAVED_COPY_BUTTON_CLICKED);
navigation_from_button_ = SHOW_SAVED_COPY_BUTTON;
if (committed_error_page_info_->reload_button_in_page) {
- chrome_common_net::RecordEvent(chrome_common_net::
+ RecordEvent(chrome_common_net::
NETWORK_ERROR_PAGE_BOTH_BUTTONS_SHOWN_SAVED_COPY_CLICKED);
}
delegate_->LoadPageFromCache(
@@ -985,24 +978,21 @@ void NetErrorHelperCore::ExecuteButtonPress(bool is_error_page, Button button) {
return;
case MORE_BUTTON:
// Visual effects on page are handled in Javascript code.
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_PAGE_MORE_BUTTON_CLICKED);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_PAGE_MORE_BUTTON_CLICKED);
return;
case EASTER_EGG:
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_EASTER_EGG_ACTIVATED);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_EASTER_EGG_ACTIVATED);
return;
case SHOW_CACHED_COPY_BUTTON:
- chrome_common_net::RecordEvent(
+ RecordEvent(
chrome_common_net::NETWORK_ERROR_PAGE_CACHED_COPY_BUTTON_CLICKED);
return;
case SHOW_CACHED_PAGE_BUTTON:
- chrome_common_net::RecordEvent(
+ RecordEvent(
chrome_common_net::NETWORK_ERROR_PAGE_CACHED_PAGE_BUTTON_CLICKED);
return;
case DIAGNOSE_ERROR:
- chrome_common_net::RecordEvent(
- chrome_common_net::NETWORK_ERROR_DIAGNOSE_BUTTON_CLICKED);
+ RecordEvent(chrome_common_net::NETWORK_ERROR_DIAGNOSE_BUTTON_CLICKED);
delegate_->DiagnoseError(
committed_error_page_info_->error.unreachableURL);
return;
diff --git a/components/error_page/renderer/net_error_helper_core_unittest.cc b/components/error_page/renderer/net_error_helper_core_unittest.cc
index e799512..4721f63 100644
--- a/components/error_page/renderer/net_error_helper_core_unittest.cc
+++ b/components/error_page/renderer/net_error_helper_core_unittest.cc
@@ -30,8 +30,6 @@ namespace {
using blink::WebURLError;
using chrome_common_net::DnsProbeStatus;
-using chrome_common_net::DnsProbeStatusToString;
-using error_page::ErrorPageParams;
const char kFailedUrl[] = "http://failed/";
const char kFailedHttpsUrl[] = "https://failed/";
@@ -120,8 +118,7 @@ std::string ErrorToString(const WebURLError& error, bool is_failed_post) {
WebURLError ProbeError(DnsProbeStatus status) {
WebURLError error;
error.unreachableURL = GURL(kFailedUrl);
- error.domain = blink::WebString::fromUTF8(
- chrome_common_net::kDnsProbeErrorDomain);
+ error.domain = blink::WebString::fromUTF8(kDnsProbeErrorDomain);
error.reason = status;
return error;
}