OLD | NEW |
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 url_string.c_str(), | 126 url_string.c_str(), |
127 token.c_str(), | 127 token.c_str(), |
128 unescaped_args.c_str()); | 128 unescaped_args.c_str()); |
129 | 129 |
130 // TODO(rogerta): what is the correct page transition? | 130 // TODO(rogerta): what is the correct page transition? |
131 tab_contents_wrapper_->tab_contents()->controller().LoadURL(GURL(url), | 131 tab_contents_wrapper_->tab_contents()->controller().LoadURL(GURL(url), |
132 GURL(), PageTransition::AUTO_BOOKMARK); | 132 GURL(), PageTransition::AUTO_BOOKMARK); |
133 } | 133 } |
134 | 134 |
135 // static | 135 // static |
136 void AutoLoginInfoBarDelegate::RegisterUserPrefs(PrefService* user_prefs) { | |
137 user_prefs->RegisterBooleanPref(prefs::kAutologinEnabled, true, | |
138 PrefService::UNSYNCABLE_PREF); | |
139 } | |
140 | |
141 // static | |
142 void AutoLoginInfoBarDelegate::ShowIfAutoLoginRequested( | 136 void AutoLoginInfoBarDelegate::ShowIfAutoLoginRequested( |
143 net::URLRequest* request, | 137 net::URLRequest* request, |
144 int child_id, | 138 int child_id, |
145 int route_id) { | 139 int route_id) { |
146 // See if the response contains the X-Auto-Login header. If so, this was | 140 // See if the response contains the X-Auto-Login header. If so, this was |
147 // a request for a login page, and the server is allowing the browser to | 141 // a request for a login page, and the server is allowing the browser to |
148 // suggest auto-login, if available. | 142 // suggest auto-login, if available. |
149 std::string value; | 143 std::string value; |
150 request->GetResponseHeaderByName("X-Auto-Login", &value); | 144 request->GetResponseHeaderByName("X-Auto-Login", &value); |
151 if (value.empty()) | 145 if (value.empty()) |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 new AutoLoginRedirector(tab_contents_wrapper_, args_); | 287 new AutoLoginRedirector(tab_contents_wrapper_, args_); |
294 return true; | 288 return true; |
295 } | 289 } |
296 | 290 |
297 bool AutoLoginInfoBarDelegate::Cancel() { | 291 bool AutoLoginInfoBarDelegate::Cancel() { |
298 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs(); | 292 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs(); |
299 user_prefs->SetBoolean(prefs::kAutologinEnabled, false); | 293 user_prefs->SetBoolean(prefs::kAutologinEnabled, false); |
300 user_prefs->ScheduleSavePersistentPrefs(); | 294 user_prefs->ScheduleSavePersistentPrefs(); |
301 return true; | 295 return true; |
302 } | 296 } |
OLD | NEW |