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..269b8e2db3ee81301dddb0712de7fe26237ec25b 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,22 @@ 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( |
| + const content::RenderProcessHost* process) { |
| + CHECK_EQ(signin_process_id_, kInvalidProcessId); |
|
Roger Tawa OOO till Jul 10th
2013/02/28 16:57:34
Hit this DCHECK while trying to repro crbug.com/17
|
| + signin_process_id_ = process->GetID(); |
| + registrar_.Add(this, |
| + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| + content::Source<content::RenderProcessHost>(process)); |
|
Charlie Reis
2013/02/28 17:33:02
You can look up the RPH from the ID, using RenderP
|
| +} |
| + |
| +bool SigninManager::IsSigninProcess( |
| + const content::RenderProcessHost* process) const { |
| + return process->GetID() == signin_process_id_; |
| } |
| SigninManager::~SigninManager() { |
| @@ -885,6 +903,14 @@ void SigninManager::Observe(int type, |
| } |
| break; |
| } |
| + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { |
| + DCHECK_EQ(signin_process_id_, |
| + content::Source<content::RenderProcessHost>(source)->GetID()); |
| + signin_process_id_ = kInvalidProcessId; |
| + registrar_.Remove(this, |
| + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| + source); |
| + } |
|
Roger Tawa OOO till Jul 10th
2013/02/28 15:17:34
missing break; statement
|
| #endif |
| default: |
| NOTREACHED(); |