Chromium Code Reviews| 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/extensions/extension_global_error.h" | 5 #include "chrome/browser/extensions/extension_global_error.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 message += l10n_util::GetStringFUTF16(template_message_id, | 79 message += l10n_util::GetStringFUTF16(template_message_id, |
| 80 string16(ASCIIToUTF16(e->name()))); | 80 string16(ASCIIToUTF16(e->name()))); |
| 81 } | 81 } |
| 82 return message; | 82 return message; |
| 83 } | 83 } |
| 84 | 84 |
| 85 string16 ExtensionGlobalError::GenerateMessage() { | 85 string16 ExtensionGlobalError::GenerateMessage() { |
| 86 return GenerateMessageSection(external_extension_ids_.get(), | 86 return GenerateMessageSection(external_extension_ids_.get(), |
| 87 IDS_EXTENSION_ALERT_ITEM_EXTERNAL) + | 87 IDS_EXTENSION_ALERT_ITEM_EXTERNAL) + |
| 88 GenerateMessageSection(blacklisted_extension_ids_.get(), | 88 GenerateMessageSection(blacklisted_extension_ids_.get(), |
| 89 IDS_EXTENSION_ALERT_ITEM_EXTERNAL) + | 89 IDS_EXTENSION_ALERT_ITEM_BLACKLISTED) + |
| 90 GenerateMessageSection(orphaned_extension_ids_.get(), | 90 GenerateMessageSection(orphaned_extension_ids_.get(), |
| 91 IDS_EXTENSION_ALERT_ITEM_EXTERNAL); | 91 IDS_EXTENSION_ALERT_ITEM_ORPHANED); |
| 92 } | 92 } |
| 93 | 93 |
| 94 string16 ExtensionGlobalError::GetBubbleViewMessage() { | 94 string16 ExtensionGlobalError::GetBubbleViewMessage() { |
| 95 if (message_.empty()) { | 95 if (message_.empty()) { |
| 96 message_ = GenerateMessage(); | 96 message_ = GenerateMessage(); |
| 97 if (message_[message_.size()-1] == '\n') | |
| 98 message_.resize(message_.size()-1); | |
|
Evan Stade
2012/03/19 21:45:56
spaces around operators.
Aaron Boodman
2012/03/19 22:00:07
Dang, how did I miss this... Thanks Evan.
chebert
2012/03/26 22:22:24
Done.
| |
| 97 } | 99 } |
| 98 return message_; | 100 return message_; |
| 99 } | 101 } |
| 100 | 102 |
| 101 string16 ExtensionGlobalError::GetBubbleViewAcceptButtonLabel() { | 103 string16 ExtensionGlobalError::GetBubbleViewAcceptButtonLabel() { |
| 102 return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_OK); | 104 return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_OK); |
| 103 } | 105 } |
| 104 | 106 |
| 105 string16 ExtensionGlobalError::GetBubbleViewCancelButtonLabel() { | 107 string16 ExtensionGlobalError::GetBubbleViewCancelButtonLabel() { |
| 106 return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_DETAILS); | 108 return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_DETAILS); |
| 107 } | 109 } |
| 108 | 110 |
| 109 void ExtensionGlobalError::OnBubbleViewDidClose(Browser* browser) { | 111 void ExtensionGlobalError::OnBubbleViewDidClose(Browser* browser) { |
| 110 extension_service_->HandleExtensionAlertClosed(); | 112 extension_service_->HandleExtensionAlertClosed(); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void ExtensionGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { | 115 void ExtensionGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { |
| 114 extension_service_->HandleExtensionAlertAccept(); | 116 extension_service_->HandleExtensionAlertAccept(); |
| 115 } | 117 } |
| 116 | 118 |
| 117 void ExtensionGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { | 119 void ExtensionGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
| 118 extension_service_->HandleExtensionAlertDetails(browser); | 120 extension_service_->HandleExtensionAlertDetails(browser); |
| 119 } | 121 } |
| OLD | NEW |