Index: chrome/browser/ui/global_error_service.cc |
diff --git a/chrome/browser/ui/global_error_service.cc b/chrome/browser/ui/global_error_service.cc |
index 3e47cc89f2fd8b75c9041175247661225af37744..45ecf11dd55837f70e93c146a40b06c7a7257f8e 100644 |
--- a/chrome/browser/ui/global_error_service.cc |
+++ b/chrome/browser/ui/global_error_service.cc |
@@ -7,6 +7,7 @@ |
#include <algorithm> |
#include "base/stl_util.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/global_error.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "content/public/browser/notification_service.h" |
@@ -60,8 +61,21 @@ GlobalError* GlobalErrorService::GetFirstGlobalErrorWithBubbleView() const { |
} |
void GlobalErrorService::NotifyErrorsChanged(GlobalError* error) { |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, |
- content::Source<Profile>(profile_), |
- content::Details<GlobalError>(error)); |
+ // GlobalErrorService is bound only to original profile so we need to send |
+ // notifications to both it and its off-the-record profile to update |
+ // incognito windows as well. |
+ std::vector<Profile*> profiles_to_notify; |
+ if (profile_ != NULL) { |
+ profiles_to_notify.push_back(profile_); |
+ if (profile_->IsOffTheRecord()) |
+ profiles_to_notify.push_back(profile_->GetOriginalProfile()); |
+ else if (profile_->HasOffTheRecordProfile()) |
+ profiles_to_notify.push_back(profile_->GetOffTheRecordProfile()); |
+ for (size_t i = 0; i < profiles_to_notify.size(); ++i) { |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, |
+ content::Source<Profile>(profiles_to_notify[i]), |
+ content::Details<GlobalError>(error)); |
+ } |
+ } |
} |