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/ui/global_error.h" | 10 #include "chrome/browser/ui/global_error.h" |
11 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
12 #include "content/common/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 | 13 |
14 GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { | 14 GlobalErrorService::GlobalErrorService(Profile* profile) : profile_(profile) { |
15 } | 15 } |
16 | 16 |
17 GlobalErrorService::~GlobalErrorService() { | 17 GlobalErrorService::~GlobalErrorService() { |
18 STLDeleteElements(&errors_); | 18 STLDeleteElements(&errors_); |
19 } | 19 } |
20 | 20 |
21 void GlobalErrorService::AddGlobalError(GlobalError* error) { | 21 void GlobalErrorService::AddGlobalError(GlobalError* error) { |
22 errors_.push_back(error); | 22 errors_.push_back(error); |
(...skipping 30 matching lines...) Expand all Loading... |
53 for (std::vector<GlobalError*>::const_iterator | 53 for (std::vector<GlobalError*>::const_iterator |
54 it = errors_.begin(); it != errors_.end(); ++it) { | 54 it = errors_.begin(); it != errors_.end(); ++it) { |
55 GlobalError* error = *it; | 55 GlobalError* error = *it; |
56 if (error->HasBubbleView() && !error->HasShownBubbleView()) | 56 if (error->HasBubbleView() && !error->HasShownBubbleView()) |
57 return error; | 57 return error; |
58 } | 58 } |
59 return NULL; | 59 return NULL; |
60 } | 60 } |
61 | 61 |
62 void GlobalErrorService::NotifyErrorsChanged(GlobalError* error) { | 62 void GlobalErrorService::NotifyErrorsChanged(GlobalError* error) { |
63 NotificationService::current()->Notify( | 63 content::NotificationService::current()->Notify( |
64 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, | 64 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, |
65 content::Source<Profile>(profile_), | 65 content::Source<Profile>(profile_), |
66 content::Details<GlobalError>(error)); | 66 content::Details<GlobalError>(error)); |
67 } | 67 } |
OLD | NEW |