| 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.h" | 5 #include "chrome/browser/ui/global_error/global_error.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" | 8 #include "chrome/browser/ui/global_error/global_error_bubble_view_base.h" |
| 9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 | 10 |
| 11 GlobalError::GlobalError() | 11 GlobalError::GlobalError() |
| 12 : has_shown_bubble_view_(false), | 12 : has_shown_bubble_view_(false), |
| 13 bubble_view_(NULL) { | 13 bubble_view_(NULL) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 GlobalError::~GlobalError() { | 16 GlobalError::~GlobalError() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 int GlobalError::GetBadgeResourceID() { | 19 int GlobalError::GetBadgeResourceID() { |
| 20 return IDR_UPDATE_BADGE4; | 20 return IDR_UPDATE_BADGE4; |
| 21 } | 21 } |
| 22 | 22 |
| 23 GlobalError::Severity GlobalError::GetSeverity() { |
| 24 switch (GetBadgeResourceID()) { |
| 25 case IDR_UPDATE_BADGE: return SEVERITY_LOW; |
| 26 case IDR_UPDATE_BADGE2: return SEVERITY_MEDIUM; |
| 27 case IDR_UPDATE_BADGE3: return SEVERITY_HIGH; |
| 28 case IDR_UPDATE_BADGE4: return SEVERITY_CRITICAL; |
| 29 default: break; |
| 30 } |
| 31 return SEVERITY_LOW; |
| 32 } |
| 33 |
| 23 int GlobalError::MenuItemIconResourceID() { | 34 int GlobalError::MenuItemIconResourceID() { |
| 24 return IDR_UPDATE_MENU4; | 35 return IDR_UPDATE_MENU4; |
| 25 } | 36 } |
| 26 | 37 |
| 27 bool GlobalError::HasShownBubbleView() { | 38 bool GlobalError::HasShownBubbleView() { |
| 28 return has_shown_bubble_view_; | 39 return has_shown_bubble_view_; |
| 29 } | 40 } |
| 30 | 41 |
| 31 void GlobalError::ShowBubbleView(Browser* browser) { | 42 void GlobalError::ShowBubbleView(Browser* browser) { |
| 32 has_shown_bubble_view_ = true; | 43 has_shown_bubble_view_ = true; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 | 56 |
| 46 int GlobalError::GetBubbleViewIconResourceID() { | 57 int GlobalError::GetBubbleViewIconResourceID() { |
| 47 return IDR_INPUT_ALERT; | 58 return IDR_INPUT_ALERT; |
| 48 } | 59 } |
| 49 | 60 |
| 50 void GlobalError::BubbleViewDidClose(Browser* browser) { | 61 void GlobalError::BubbleViewDidClose(Browser* browser) { |
| 51 DCHECK(browser); | 62 DCHECK(browser); |
| 52 bubble_view_ = NULL; | 63 bubble_view_ = NULL; |
| 53 OnBubbleViewDidClose(browser); | 64 OnBubbleViewDidClose(browser); |
| 54 } | 65 } |
| OLD | NEW |