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

Unified Diff: components/captive_portal/captive_portal_detector.cc

Issue 242483003: Move CaptivePortalDetector to src/components/captive_portal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: components/captive_portal/captive_portal_detector.cc
diff --git a/chrome/browser/captive_portal/captive_portal_detector.cc b/components/captive_portal/captive_portal_detector.cc
similarity index 84%
rename from chrome/browser/captive_portal/captive_portal_detector.cc
rename to components/captive_portal/captive_portal_detector.cc
index 846566b107a13e4fe5c25dc9493e4e36714c8988..912b7e419ba0c007bbb567e188163865566a5960 100644
--- a/chrome/browser/captive_portal/captive_portal_detector.cc
+++ b/components/captive_portal/captive_portal_detector.cc
@@ -2,30 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/captive_portal/captive_portal_detector.h"
+#include "components/captive_portal/captive_portal_detector.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
-#include "chrome/browser/profiles/profile.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"
namespace captive_portal {
-namespace {
-
-const char* const kCaptivePortalResultNames[] = {
- "InternetConnected",
- "NoResponse",
- "BehindCaptivePortal",
- "NumCaptivePortalResults",
-};
-COMPILE_ASSERT(arraysize(kCaptivePortalResultNames) == RESULT_COUNT + 1,
- captive_portal_result_name_count_mismatch);
-
-} // namespace
-
const char CaptivePortalDetector::kDefaultURL[] =
"http://www.gstatic.com/generate_204";
@@ -37,14 +23,6 @@ CaptivePortalDetector::CaptivePortalDetector(
CaptivePortalDetector::~CaptivePortalDetector() {
}
-// static
-std::string CaptivePortalDetector::CaptivePortalResultToString(Result result) {
- DCHECK_GE(result, 0);
- DCHECK_LT(static_cast<unsigned int>(result),
- arraysize(kCaptivePortalResultNames));
- return kCaptivePortalResultNames[result];
-}
-
void CaptivePortalDetector::DetectCaptivePortal(
const GURL& url,
const DetectionCallback& detection_callback) {
@@ -100,7 +78,7 @@ void CaptivePortalDetector::GetCaptivePortalResultFromResponse(
DCHECK(results);
DCHECK(!url_fetcher->GetStatus().is_io_pending());
- results->result = RESULT_NO_RESPONSE;
+ results->result = captive_portal::RESULT_NO_RESPONSE;
results->response_code = url_fetcher->GetResponseCode();
results->retry_after_delta = base::TimeDelta();
results->landing_url = url_fetcher->GetURL();
@@ -138,7 +116,7 @@ void CaptivePortalDetector::GetCaptivePortalResultFromResponse(
// to login to whatever server issued the response.
// See: http://tools.ietf.org/html/rfc6585
if (results->response_code == 511) {
- results->result = RESULT_BEHIND_CAPTIVE_PORTAL;
+ results->result = captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL;
return;
}
@@ -148,12 +126,12 @@ void CaptivePortalDetector::GetCaptivePortalResultFromResponse(
// A 204 response code indicates there's no captive portal.
if (results->response_code == 204) {
- results->result = RESULT_INTERNET_CONNECTED;
+ results->result = captive_portal::RESULT_INTERNET_CONNECTED;
return;
}
// Otherwise, assume it's a captive portal.
- results->result = RESULT_BEHIND_CAPTIVE_PORTAL;
+ results->result = captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL;
}
base::Time CaptivePortalDetector::GetCurrentTime() const {
« no previous file with comments | « components/captive_portal/captive_portal_detector.h ('k') | components/captive_portal/captive_portal_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698