| OLD | NEW |
| 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/signin/chrome_signin_client.h" | 5 #include "chrome/browser/signin/chrome_signin_client.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/content_settings/cookie_settings.h" | 8 #include "chrome/browser/content_settings/cookie_settings.h" |
| 9 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 9 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 10 #include "chrome/browser/signin/local_auth.h" | 10 #include "chrome/browser/signin/local_auth.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 DCHECK(host); | 72 DCHECK(host); |
| 73 host->AddObserver(this); | 73 host->AddObserver(this); |
| 74 signin_hosts_observed_.insert(host); | 74 signin_hosts_observed_.insert(host); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void ChromeSigninClient::ClearSigninProcess() { | 77 void ChromeSigninClient::ClearSigninProcess() { |
| 78 signin_host_id_ = ChildProcessHost::kInvalidUniqueID; | 78 signin_host_id_ = ChildProcessHost::kInvalidUniqueID; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool ChromeSigninClient::IsSigninProcess(int process_id) const { | 81 bool ChromeSigninClient::IsSigninProcess(int process_id) const { |
| 82 return process_id == signin_host_id_; | 82 return process_id != ChildProcessHost::kInvalidUniqueID && |
| 83 process_id == signin_host_id_; |
| 83 } | 84 } |
| 84 | 85 |
| 85 bool ChromeSigninClient::HasSigninProcess() const { | 86 bool ChromeSigninClient::HasSigninProcess() const { |
| 86 return signin_host_id_ != ChildProcessHost::kInvalidUniqueID; | 87 return signin_host_id_ != ChildProcessHost::kInvalidUniqueID; |
| 87 } | 88 } |
| 88 | 89 |
| 89 void ChromeSigninClient::RenderProcessHostDestroyed(RenderProcessHost* host) { | 90 void ChromeSigninClient::RenderProcessHostDestroyed(RenderProcessHost* host) { |
| 90 // It's possible we're listening to a "stale" renderer because it was replaced | 91 // It's possible we're listening to a "stale" renderer because it was replaced |
| 91 // with a new process by process-per-site. In either case, stop observing it, | 92 // with a new process by process-per-site. In either case, stop observing it, |
| 92 // but only reset signin_host_id_ tracking if this was from the current signin | 93 // but only reset signin_host_id_ tracking if this was from the current signin |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 194 |
| 194 void ChromeSigninClient::UnregisterForCookieChangedNotification() { | 195 void ChromeSigninClient::UnregisterForCookieChangedNotification() { |
| 195 // Note that it's allowed to call this method multiple times without an | 196 // Note that it's allowed to call this method multiple times without an |
| 196 // intervening call to |RegisterForCookieChangedNotification()|. | 197 // intervening call to |RegisterForCookieChangedNotification()|. |
| 197 content::Source<Profile> source(profile_); | 198 content::Source<Profile> source(profile_); |
| 198 if (!registrar_.IsRegistered( | 199 if (!registrar_.IsRegistered( |
| 199 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) | 200 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) |
| 200 return; | 201 return; |
| 201 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); | 202 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); |
| 202 } | 203 } |
| OLD | NEW |