Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/global_error_service.h" | 5 #include "chrome/browser/ui/global_error_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "chrome/browser/ui/global_error.h" | 11 #include "chrome/browser/ui/global_error.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 13 | 14 |
| 14 GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { | 15 GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { |
| 15 } | 16 } |
| 16 | 17 |
| 17 GlobalErrorService::~GlobalErrorService() { | 18 GlobalErrorService::~GlobalErrorService() { |
| 18 STLDeleteElements(&errors_); | 19 STLDeleteElements(&errors_); |
| 19 } | 20 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 for (std::vector<GlobalError*>::const_iterator | 54 for (std::vector<GlobalError*>::const_iterator |
| 54 it = errors_.begin(); it != errors_.end(); ++it) { | 55 it = errors_.begin(); it != errors_.end(); ++it) { |
| 55 GlobalError* error = *it; | 56 GlobalError* error = *it; |
| 56 if (error->HasBubbleView() && !error->HasShownBubbleView()) | 57 if (error->HasBubbleView() && !error->HasShownBubbleView()) |
| 57 return error; | 58 return error; |
| 58 } | 59 } |
| 59 return NULL; | 60 return NULL; |
| 60 } | 61 } |
| 61 | 62 |
| 62 void GlobalErrorService::NotifyErrorsChanged(GlobalError* error) { | 63 void GlobalErrorService::NotifyErrorsChanged(GlobalError* error) { |
| 63 content::NotificationService::current()->Notify( | 64 std::vector<Profile*> profiles_to_notify; |
|
sail
2011/12/08 17:44:45
can you add a DCHECK() for ServiceRedirectedInInco
whywhat
2011/12/09 11:14:33
I've added comment. How can I check ServiceRedirec
sail
2011/12/09 17:43:51
Ahh damn, never mind.
| |
| 64 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, | 65 if (profile_ != NULL) { |
| 65 content::Source<Profile>(profile_), | 66 profiles_to_notify.push_back(profile_); |
| 66 content::Details<GlobalError>(error)); | 67 if (profile_->IsOffTheRecord()) |
| 68 profiles_to_notify.push_back(profile_->GetOriginalProfile()); | |
| 69 else if (profile_->HasOffTheRecordProfile()) | |
| 70 profiles_to_notify.push_back(profile_->GetOffTheRecordProfile()); | |
| 71 for (size_t i = 0; i < profiles_to_notify.size(); ++i) { | |
| 72 content::NotificationService::current()->Notify( | |
| 73 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, | |
| 74 content::Source<Profile>(profiles_to_notify[i]), | |
| 75 content::Details<GlobalError>(error)); | |
| 76 } | |
| 77 } | |
| 67 } | 78 } |
| OLD | NEW |