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

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

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes 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
« no previous file with comments | « chrome/browser/translate/translate_manager_browsertest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/infobars/infobar_tab_helper.h"
13 #include "chrome/browser/net/gaia/token_service.h" 14 #include "chrome/browser/net/gaia/token_service.h"
14 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
17 #include "chrome/browser/sync/profile_sync_service.h" 18 #include "chrome/browser/sync/profile_sync_service.h"
18 #include "chrome/browser/sync/signin_manager.h" 19 #include "chrome/browser/sync/signin_manager.h"
19 #include "chrome/browser/tab_contents/tab_util.h" 20 #include "chrome/browser/tab_contents/tab_util.h"
20 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/net/gaia/gaia_constants.h" 23 #include "chrome/common/net/gaia/gaia_constants.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 238 }
238 239
239 AutoLoginInfoBarDelegate::~AutoLoginInfoBarDelegate() { 240 AutoLoginInfoBarDelegate::~AutoLoginInfoBarDelegate() {
240 } 241 }
241 242
242 void AutoLoginInfoBarDelegate::Observe(int type, 243 void AutoLoginInfoBarDelegate::Observe(int type,
243 const NotificationSource& source, 244 const NotificationSource& source,
244 const NotificationDetails& details) { 245 const NotificationDetails& details) {
245 if (type == content::NOTIFICATION_LOAD_STOP) { 246 if (type == content::NOTIFICATION_LOAD_STOP) {
246 // The wrapper takes ownership of this delegate. 247 // The wrapper takes ownership of this delegate.
247 tab_contents_wrapper_->AddInfoBar(this); 248 tab_contents_wrapper_->infobar_tab_helper()->AddInfoBar(this);
248 registrar_.RemoveAll(); 249 registrar_.RemoveAll();
249 } else if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) { 250 } else if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) {
250 // The tab contents was destroyed before the naviagation completed, so 251 // The tab contents was destroyed before the naviagation completed, so
251 // just cleanup this delegate. 252 // just cleanup this delegate.
252 delete this; 253 delete this;
253 } else { 254 } else {
254 NOTREACHED() << "Unexpected notification type"; 255 NOTREACHED() << "Unexpected notification type";
255 } 256 }
256 } 257 }
257 258
(...skipping 26 matching lines...) Expand all
284 new AutoLoginRedirector(tab_contents_wrapper_, args_); 285 new AutoLoginRedirector(tab_contents_wrapper_, args_);
285 return true; 286 return true;
286 } 287 }
287 288
288 bool AutoLoginInfoBarDelegate::Cancel() { 289 bool AutoLoginInfoBarDelegate::Cancel() {
289 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs(); 290 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs();
290 user_prefs->SetBoolean(prefs::kAutologinEnabled, false); 291 user_prefs->SetBoolean(prefs::kAutologinEnabled, false);
291 user_prefs->ScheduleSavePersistentPrefs(); 292 user_prefs->ScheduleSavePersistentPrefs();
292 return true; 293 return true;
293 } 294 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_manager_browsertest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698