| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/global_error_service.h" | 5 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/global_error/global_error.h" | 14 #include "chrome/browser/ui/global_error/global_error.h" |
| 15 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" | 15 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" |
| 16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 | 17 |
| 18 GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { | 18 GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 GlobalErrorService::~GlobalErrorService() { | 21 GlobalErrorService::~GlobalErrorService() { |
| 22 STLDeleteElements(&errors_); | 22 base::STLDeleteElements(&errors_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void GlobalErrorService::AddGlobalError(GlobalError* error) { | 25 void GlobalErrorService::AddGlobalError(GlobalError* error) { |
| 26 DCHECK(error); | 26 DCHECK(error); |
| 27 errors_.push_back(error); | 27 errors_.push_back(error); |
| 28 NotifyErrorsChanged(error); | 28 NotifyErrorsChanged(error); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void GlobalErrorService::RemoveGlobalError(GlobalError* error) { | 31 void GlobalErrorService::RemoveGlobalError(GlobalError* error) { |
| 32 errors_.erase(std::find(errors_.begin(), errors_.end(), error)); | 32 errors_.erase(std::find(errors_.begin(), errors_.end(), error)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 else if (profile_->HasOffTheRecordProfile()) | 88 else if (profile_->HasOffTheRecordProfile()) |
| 89 profiles_to_notify.push_back(profile_->GetOffTheRecordProfile()); | 89 profiles_to_notify.push_back(profile_->GetOffTheRecordProfile()); |
| 90 for (size_t i = 0; i < profiles_to_notify.size(); ++i) { | 90 for (size_t i = 0; i < profiles_to_notify.size(); ++i) { |
| 91 content::NotificationService::current()->Notify( | 91 content::NotificationService::current()->Notify( |
| 92 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, | 92 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, |
| 93 content::Source<Profile>(profiles_to_notify[i]), | 93 content::Source<Profile>(profiles_to_notify[i]), |
| 94 content::Details<GlobalError>(error)); | 94 content::Details<GlobalError>(error)); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 } | 97 } |
| OLD | NEW |