Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1154)

Side by Side Diff: chrome/browser/ui/global_error/global_error_service.cc

Issue 11150002: New post-sideload UI: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: !!! Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <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/profiles/profile.h"
(...skipping 27 matching lines...) Expand all
38 for (GlobalErrorList::const_iterator 38 for (GlobalErrorList::const_iterator
39 it = errors_.begin(); it != errors_.end(); ++it) { 39 it = errors_.begin(); it != errors_.end(); ++it) {
40 GlobalError* error = *it; 40 GlobalError* error = *it;
41 if (error->HasMenuItem() && command_id == error->MenuItemCommandID()) 41 if (error->HasMenuItem() && command_id == error->MenuItemCommandID())
42 return error; 42 return error;
43 } 43 }
44 return NULL; 44 return NULL;
45 } 45 }
46 46
47 int GlobalErrorService::GetFirstBadgeResourceID() const { 47 int GlobalErrorService::GetFirstBadgeResourceID() const {
48 GlobalError::Severity highest_severity = GlobalError::SEVERITY_LOW;
49 int resource_id = 0;
50
48 for (GlobalErrorList::const_iterator 51 for (GlobalErrorList::const_iterator
49 it = errors_.begin(); it != errors_.end(); ++it) { 52 it = errors_.begin(); it != errors_.end(); ++it) {
50 GlobalError* error = *it; 53 GlobalError* error = *it;
51 if (error->HasBadge()) 54 if (error->HasBadge()) {
52 return error->GetBadgeResourceID(); 55 if (resource_id == 0 || error->GetSeverity() > highest_severity) {
56 highest_severity = error->GetSeverity();
57 resource_id = error->GetBadgeResourceID();
58 }
59 }
53 } 60 }
54 return 0; 61
62 return resource_id;
55 } 63 }
56 64
57 GlobalError* GlobalErrorService::GetFirstGlobalErrorWithBubbleView() const { 65 GlobalError* GlobalErrorService::GetFirstGlobalErrorWithBubbleView() const {
58 for (GlobalErrorList::const_iterator 66 for (GlobalErrorList::const_iterator
59 it = errors_.begin(); it != errors_.end(); ++it) { 67 it = errors_.begin(); it != errors_.end(); ++it) {
60 GlobalError* error = *it; 68 GlobalError* error = *it;
61 if (error->HasBubbleView() && !error->HasShownBubbleView()) 69 if (error->HasBubbleView() && !error->HasShownBubbleView())
62 return error; 70 return error;
63 } 71 }
64 return NULL; 72 return NULL;
(...skipping 11 matching lines...) Expand all
76 else if (profile_->HasOffTheRecordProfile()) 84 else if (profile_->HasOffTheRecordProfile())
77 profiles_to_notify.push_back(profile_->GetOffTheRecordProfile()); 85 profiles_to_notify.push_back(profile_->GetOffTheRecordProfile());
78 for (size_t i = 0; i < profiles_to_notify.size(); ++i) { 86 for (size_t i = 0; i < profiles_to_notify.size(); ++i) {
79 content::NotificationService::current()->Notify( 87 content::NotificationService::current()->Notify(
80 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, 88 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED,
81 content::Source<Profile>(profiles_to_notify[i]), 89 content::Source<Profile>(profiles_to_notify[i]),
82 content::Details<GlobalError>(error)); 90 content::Details<GlobalError>(error));
83 } 91 }
84 } 92 }
85 } 93 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/global_error/global_error.cc ('k') | chrome/browser/ui/global_error/global_error_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698