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

Unified Diff: chrome/browser/signin/chrome_signin_client.cc

Issue 216703002: Move the SigninProcess APIs from SigninManager to ChromeSigninClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove cruft Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/signin_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/chrome_signin_client.cc
diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc
index 74e31c463354e89b7e50c4d58604d9bf52b2cb68..15c2fbad2435322f2fff2d3e558d1f6f7dea4b27 100644
--- a/chrome/browser/signin/chrome_signin_client.cc
+++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -8,6 +8,8 @@
#include "chrome/browser/signin/local_auth.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/profile_management_switches.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/common/child_process_host.h"
#include "url/gurl.h"
#if defined(ENABLE_MANAGED_USERS)
@@ -18,15 +20,25 @@
#include "chrome/browser/chromeos/login/user_manager.h"
#endif
+using content::ChildProcessHost;
+using content::RenderProcessHost;
+
namespace {
const char kGoogleAccountsUrl[] = "https://accounts.google.com";
} // namespace
-ChromeSigninClient::ChromeSigninClient(Profile* profile) : profile_(profile) {}
+ChromeSigninClient::ChromeSigninClient(Profile* profile)
+ : profile_(profile), signin_host_id_(ChildProcessHost::kInvalidUniqueID) {}
-ChromeSigninClient::~ChromeSigninClient() {}
+ChromeSigninClient::~ChromeSigninClient() {
+ std::set<RenderProcessHost*>::iterator i;
+ for (i = signin_hosts_observed_.begin(); i != signin_hosts_observed_.end();
+ ++i) {
+ (*i)->RemoveObserver(this);
+ }
+}
// static
bool ChromeSigninClient::ProfileAllowsSigninCookies(Profile* profile) {
@@ -43,6 +55,40 @@ bool ChromeSigninClient::SettingsAllowSigninCookies(
GURL(kGoogleAccountsUrl));
}
+void ChromeSigninClient::SetSigninProcess(int process_id) {
+ if (process_id == signin_host_id_)
+ return;
+ DLOG_IF(WARNING, signin_host_id_ != ChildProcessHost::kInvalidUniqueID)
+ << "Replacing in-use signin process.";
+ signin_host_id_ = process_id;
+ RenderProcessHost* host = RenderProcessHost::FromID(process_id);
+ DCHECK(host);
+ host->AddObserver(this);
+ signin_hosts_observed_.insert(host);
+}
+
+void ChromeSigninClient::ClearSigninProcess() {
+ signin_host_id_ = ChildProcessHost::kInvalidUniqueID;
+}
+
+bool ChromeSigninClient::IsSigninProcess(int process_id) const {
+ return process_id == signin_host_id_;
+}
+
+bool ChromeSigninClient::HasSigninProcess() const {
+ return signin_host_id_ != ChildProcessHost::kInvalidUniqueID;
+}
+
+void ChromeSigninClient::RenderProcessHostDestroyed(RenderProcessHost* host) {
+ // It's possible we're listening to a "stale" renderer because it was replaced
+ // with a new process by process-per-site. In either case, stop observing it,
+ // but only reset signin_host_id_ tracking if this was from the current signin
+ // process.
+ signin_hosts_observed_.erase(host);
+ if (signin_host_id_ == host->GetID())
+ signin_host_id_ = ChildProcessHost::kInvalidUniqueID;
+}
+
PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); }
scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() {
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/signin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698