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

Side by Side Diff: chrome/browser/ui/autologin_infobar_delegate.cc

Issue 7740083: Put pre- and auto-login behind flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/autologin_infobar_delegate.h" 5 #include "chrome/browser/ui/autologin_infobar_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // TODO(rogerta): what is the correct page transition? 131 // TODO(rogerta): what is the correct page transition?
132 tab_contents_wrapper_->tab_contents()->controller().LoadURL(GURL(url), 132 tab_contents_wrapper_->tab_contents()->controller().LoadURL(GURL(url),
133 GURL(), PageTransition::AUTO_BOOKMARK); 133 GURL(), PageTransition::AUTO_BOOKMARK);
134 } 134 }
135 135
136 // static 136 // static
137 void AutoLoginInfoBarDelegate::ShowIfAutoLoginRequested( 137 void AutoLoginInfoBarDelegate::ShowIfAutoLoginRequested(
138 net::URLRequest* request, 138 net::URLRequest* request,
139 int child_id, 139 int child_id,
140 int route_id) { 140 int route_id) {
141 if (!CommandLine::ForCurrentProcess()->HasSwitch(
142 switches::kEnableAutologin)) {
143 return;
144 }
145
141 // See if the response contains the X-Auto-Login header. If so, this was 146 // See if the response contains the X-Auto-Login header. If so, this was
142 // a request for a login page, and the server is allowing the browser to 147 // a request for a login page, and the server is allowing the browser to
143 // suggest auto-login, if available. 148 // suggest auto-login, if available.
144 std::string value; 149 std::string value;
145 request->GetResponseHeaderByName("X-Auto-Login", &value); 150 request->GetResponseHeaderByName("X-Auto-Login", &value);
146 if (value.empty()) 151 if (value.empty())
147 return; 152 return;
148 153
149 std::vector<std::pair<std::string, std::string> > pairs; 154 std::vector<std::pair<std::string, std::string> > pairs;
150 if (!base::SplitStringIntoKeyValuePairs(value, '=', '&', &pairs)) 155 if (!base::SplitStringIntoKeyValuePairs(value, '=', '&', &pairs))
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 new AutoLoginRedirector(tab_contents_wrapper_, args_); 289 new AutoLoginRedirector(tab_contents_wrapper_, args_);
285 return true; 290 return true;
286 } 291 }
287 292
288 bool AutoLoginInfoBarDelegate::Cancel() { 293 bool AutoLoginInfoBarDelegate::Cancel() {
289 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs(); 294 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs();
290 user_prefs->SetBoolean(prefs::kAutologinEnabled, false); 295 user_prefs->SetBoolean(prefs::kAutologinEnabled, false);
291 user_prefs->ScheduleSavePersistentPrefs(); 296 user_prefs->ScheduleSavePersistentPrefs();
292 return true; 297 return true;
293 } 298 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/signin_manager.cc ('k') | chrome/browser/ui/webui/options/personal_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698