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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_service.cc

Issue 10795038: Enable captive portal detection by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/captive_portal/captive_portal_service.h" 5 #include "chrome/browser/captive_portal/captive_portal_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } else { 319 } else {
320 recheck_policy_.backoff_policy.initial_delay_ms = 320 recheck_policy_.backoff_policy.initial_delay_ms =
321 recheck_policy_.initial_backoff_no_portal_ms; 321 recheck_policy_.initial_backoff_no_portal_ms;
322 } 322 }
323 323
324 backoff_entry_.reset(new RecheckBackoffEntry(this)); 324 backoff_entry_.reset(new RecheckBackoffEntry(this));
325 } 325 }
326 326
327 void CaptivePortalService::UpdateEnabledState() { 327 void CaptivePortalService::UpdateEnabledState() {
328 bool enabled_before = enabled_; 328 bool enabled_before = enabled_;
329 enabled_ = resolve_errors_with_web_service_.GetValue() && 329
330 CommandLine::ForCurrentProcess()->HasSwitch( 330 // Default value.
331 switches::kCaptivePortalDetection); 331 bool allowed_by_command_line = true;
332
333 std::string command_line_value =
334 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
335 switches::kCaptivePortalDetection);
336 if (command_line_value == switches::kCaptivePortalDetectionDisabled) {
337 allowed_by_command_line = false;
338 } else if (command_line_value == switches::kCaptivePortalDetectionEnabled) {
339 allowed_by_command_line = true;
340 }
341
342 enabled_ = allowed_by_command_line &&
343 resolve_errors_with_web_service_.GetValue();
332 if (enabled_before == enabled_) 344 if (enabled_before == enabled_)
333 return; 345 return;
334 346
335 // Clear data used for histograms. 347 // Clear data used for histograms.
336 num_checks_with_same_result_ = 0; 348 num_checks_with_same_result_ = 0;
337 first_check_time_with_same_result_ = base::TimeTicks(); 349 first_check_time_with_same_result_ = base::TimeTicks();
338 last_check_time_ = base::TimeTicks(); 350 last_check_time_ = base::TimeTicks();
339 351
340 ResetBackoffEntry(last_detection_result_); 352 ResetBackoffEntry(last_detection_result_);
341 353
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 426
415 bool CaptivePortalService::FetchingURL() const { 427 bool CaptivePortalService::FetchingURL() const {
416 return url_fetcher_.get() != NULL; 428 return url_fetcher_.get() != NULL;
417 } 429 }
418 430
419 bool CaptivePortalService::TimerRunning() const { 431 bool CaptivePortalService::TimerRunning() const {
420 return check_captive_portal_timer_.IsRunning(); 432 return check_captive_portal_timer_.IsRunning();
421 } 433 }
422 434
423 } // namespace captive_portal 435 } // namespace captive_portal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698