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

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

Issue 257153003: We have a problem in the process on destroying WebContentsImpl because (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto origin/master again, resolved conflicts Created 6 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/auto_login_infobar_delegate.h" 5 #include "chrome/browser/ui/auto_login_infobar_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 AutoLoginRedirector(content::WebContents* web_contents, 56 AutoLoginRedirector(content::WebContents* web_contents,
57 const std::string& args); 57 const std::string& args);
58 virtual ~AutoLoginRedirector(); 58 virtual ~AutoLoginRedirector();
59 59
60 private: 60 private:
61 // Overriden from UbertokenConsumer: 61 // Overriden from UbertokenConsumer:
62 virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE; 62 virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE;
63 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE; 63 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE;
64 64
65 // Implementation of content::WebContentsObserver 65 // Implementation of content::WebContentsObserver
66 virtual void WebContentsDestroyed( 66 virtual void WebContentsDestroyed() OVERRIDE;
67 content::WebContents* web_contents) OVERRIDE;
68 67
69 // Redirect tab to MergeSession URL, logging the user in and navigating 68 // Redirect tab to MergeSession URL, logging the user in and navigating
70 // to the desired page. 69 // to the desired page.
71 void RedirectToMergeSession(const std::string& token); 70 void RedirectToMergeSession(const std::string& token);
72 71
73 const std::string args_; 72 const std::string args_;
74 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_; 73 scoped_ptr<UbertokenFetcher> ubertoken_fetcher_;
75 74
76 DISALLOW_COPY_AND_ASSIGN(AutoLoginRedirector); 75 DISALLOW_COPY_AND_ASSIGN(AutoLoginRedirector);
77 }; 76 };
(...skipping 12 matching lines...) Expand all
90 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service, 89 ubertoken_fetcher_.reset(new UbertokenFetcher(token_service,
91 this, 90 this,
92 profile->GetRequestContext())); 91 profile->GetRequestContext()));
93 ubertoken_fetcher_->StartFetchingToken( 92 ubertoken_fetcher_->StartFetchingToken(
94 signin_manager->GetAuthenticatedAccountId()); 93 signin_manager->GetAuthenticatedAccountId());
95 } 94 }
96 95
97 AutoLoginRedirector::~AutoLoginRedirector() { 96 AutoLoginRedirector::~AutoLoginRedirector() {
98 } 97 }
99 98
100 void AutoLoginRedirector::WebContentsDestroyed( 99 void AutoLoginRedirector::WebContentsDestroyed() {
101 content::WebContents* web_contents) {
102 // The WebContents that started this has been destroyed. The request must be 100 // The WebContents that started this has been destroyed. The request must be
103 // cancelled and this object must be deleted. 101 // cancelled and this object must be deleted.
104 ubertoken_fetcher_.reset(); 102 ubertoken_fetcher_.reset();
105 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 103 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
106 } 104 }
107 105
108 void AutoLoginRedirector::OnUbertokenSuccess(const std::string& token) { 106 void AutoLoginRedirector::OnUbertokenSuccess(const std::string& token) {
109 RedirectToMergeSession(token); 107 RedirectToMergeSession(token);
110 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 108 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
111 } 109 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 web_contents->GetBrowserContext())->GetPrefs(); 229 web_contents->GetBrowserContext())->GetPrefs();
232 pref_service->SetBoolean(prefs::kAutologinEnabled, false); 230 pref_service->SetBoolean(prefs::kAutologinEnabled, false);
233 RecordHistogramAction(REJECTED); 231 RecordHistogramAction(REJECTED);
234 button_pressed_ = true; 232 button_pressed_ = true;
235 return true; 233 return true;
236 } 234 }
237 235
238 void AutoLoginInfoBarDelegate::GoogleSignedOut(const std::string& username) { 236 void AutoLoginInfoBarDelegate::GoogleSignedOut(const std::string& username) {
239 infobar()->RemoveSelf(); 237 infobar()->RemoveSelf();
240 } 238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698