| 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/protector/settings_change_global_error.h" | 5 #include "chrome/browser/protector/settings_change_global_error.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 DCHECK(delegate_); | 40 DCHECK(delegate_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 SettingsChangeGlobalError::~SettingsChangeGlobalError() { | 43 SettingsChangeGlobalError::~SettingsChangeGlobalError() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool SettingsChangeGlobalError::HasBadge() { | 46 bool SettingsChangeGlobalError::HasBadge() { |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 int SettingsChangeGlobalError::GetBadgeResourceID() { |
| 51 return change_->GetBadgeIconID(); |
| 52 } |
| 53 |
| 50 bool SettingsChangeGlobalError::HasMenuItem() { | 54 bool SettingsChangeGlobalError::HasMenuItem() { |
| 51 return true; | 55 return true; |
| 52 } | 56 } |
| 53 | 57 |
| 54 int SettingsChangeGlobalError::MenuItemCommandID() { | 58 int SettingsChangeGlobalError::MenuItemCommandID() { |
| 55 return IDC_SHOW_SETTINGS_CHANGES; | 59 return IDC_SHOW_SETTINGS_CHANGES; |
| 56 } | 60 } |
| 57 | 61 |
| 58 string16 SettingsChangeGlobalError::MenuItemLabel() { | 62 string16 SettingsChangeGlobalError::MenuItemLabel() { |
| 59 return change_->GetBubbleTitle(); | 63 return change_->GetBubbleTitle(); |
| 60 } | 64 } |
| 61 | 65 |
| 66 int SettingsChangeGlobalError::MenuItemIconResourceID() { |
| 67 return change_->GetMenuItemIconID(); |
| 68 } |
| 69 |
| 62 void SettingsChangeGlobalError::ExecuteMenuItem(Browser* browser) { | 70 void SettingsChangeGlobalError::ExecuteMenuItem(Browser* browser) { |
| 63 // Cancel previously posted tasks. | 71 // Cancel previously posted tasks. |
| 64 weak_factory_.InvalidateWeakPtrs(); | 72 weak_factory_.InvalidateWeakPtrs(); |
| 65 browser_ = browser; | 73 browser_ = browser; |
| 66 ShowBubbleView(browser_); | 74 ShowBubbleView(browser_); |
| 67 } | 75 } |
| 68 | 76 |
| 69 bool SettingsChangeGlobalError::HasBubbleView() { | 77 bool SettingsChangeGlobalError::HasBubbleView() { |
| 70 return true; | 78 return true; |
| 71 } | 79 } |
| 72 | 80 |
| 81 int SettingsChangeGlobalError::GetBubbleViewIconResourceID() { |
| 82 return change_->GetBubbleIconID(); |
| 83 } |
| 84 |
| 73 string16 SettingsChangeGlobalError::GetBubbleViewTitle() { | 85 string16 SettingsChangeGlobalError::GetBubbleViewTitle() { |
| 74 return change_->GetBubbleTitle(); | 86 return change_->GetBubbleTitle(); |
| 75 } | 87 } |
| 76 | 88 |
| 77 string16 SettingsChangeGlobalError::GetBubbleViewMessage() { | 89 string16 SettingsChangeGlobalError::GetBubbleViewMessage() { |
| 78 return change_->GetBubbleMessage(); | 90 return change_->GetBubbleMessage(); |
| 79 } | 91 } |
| 80 | 92 |
| 81 // The Accept and Revert buttons are swapped like the 'server' and 'client' | 93 // The Accept and Revert buttons are swapped like the 'server' and 'client' |
| 82 // concepts in X11. Accept button (the default one) discards changes | 94 // concepts in X11. Accept button (the default one) discards changes |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (browser_) | 158 if (browser_) |
| 147 ShowBubbleView(browser_); | 159 ShowBubbleView(browser_); |
| 148 } | 160 } |
| 149 | 161 |
| 150 void SettingsChangeGlobalError::OnInactiveTimeout() { | 162 void SettingsChangeGlobalError::OnInactiveTimeout() { |
| 151 delegate_->OnDecisionTimeout(); | 163 delegate_->OnDecisionTimeout(); |
| 152 RemoveFromProfile(); | 164 RemoveFromProfile(); |
| 153 } | 165 } |
| 154 | 166 |
| 155 } // namespace protector | 167 } // namespace protector |
| OLD | NEW |