Chromium Code Reviews| Index: chrome/browser/signin/signin_manager.cc |
| diff --git a/chrome/browser/signin/signin_manager.cc b/chrome/browser/signin/signin_manager.cc |
| index 92dc661587c19bf40f56a0df0524eafa40427e41..7861fbc3bcfca29168265376afdf2ac7860916c3 100644 |
| --- a/chrome/browser/signin/signin_manager.cc |
| +++ b/chrome/browser/signin/signin_manager.cc |
| @@ -37,6 +37,7 @@ |
| #include "chrome/common/pref_names.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/notification_service.h" |
| +#include "content/public/browser/render_process_host.h" |
| #include "google_apis/gaia/gaia_auth_fetcher.h" |
| #include "google_apis/gaia/gaia_auth_util.h" |
| #include "google_apis/gaia/gaia_constants.h" |
| @@ -62,6 +63,8 @@ const char kGetInfoEmailKey[] = "email"; |
| const char kGoogleAccountsUrl[] = "https://accounts.google.com"; |
| +const int kInvalidProcessId = -1; |
| + |
| } // namespace |
| // This class fetches GAIA cookie on IO thread on behalf of SigninManager which |
| @@ -199,7 +202,25 @@ SigninManager::SigninManager() |
| prohibit_signout_(false), |
| had_two_factor_error_(false), |
| type_(SIGNIN_TYPE_NONE), |
| - weak_pointer_factory_(this) { |
| + weak_pointer_factory_(this), |
| + signin_process_id_(kInvalidProcessId) { |
| +} |
| + |
| +void SigninManager::SetSigninProcess(int process_id) { |
| + if (process_id == signin_process_id_) |
| + return; |
| + CHECK_EQ(signin_process_id_, kInvalidProcessId); |
|
Charlie Reis
2013/02/28 19:19:46
I don't think we can enforce this CHECK. There ar
tim (not reviewing)
2013/03/01 01:53:57
Done.
|
| + signin_process_id_ = process_id; |
| + const content::RenderProcessHost* process = |
| + content::RenderProcessHost::FromID(process_id); |
| + DCHECK(process); |
| + registrar_.Add(this, |
| + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| + content::Source<content::RenderProcessHost>(process)); |
| +} |
| + |
| +bool SigninManager::IsSigninProcess(int process_id) const { |
| + return process_id == signin_process_id_; |
| } |
| SigninManager::~SigninManager() { |
| @@ -885,6 +906,15 @@ void SigninManager::Observe(int type, |
| } |
| break; |
| } |
| + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { |
| + DCHECK_EQ(signin_process_id_, |
|
Charlie Reis
2013/02/28 19:19:46
Similar to above, this should be an if rather than
tim (not reviewing)
2013/03/01 01:53:57
Done.
|
| + content::Source<content::RenderProcessHost>(source)->GetID()); |
| + signin_process_id_ = kInvalidProcessId; |
| + registrar_.Remove(this, |
| + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| + source); |
| + break; |
| + } |
| #endif |
| default: |
| NOTREACHED(); |