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/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" |
11 #include "chrome/browser/ui/global_error.h" | 11 #include "chrome/browser/ui/global_error.h" |
| 12 #include "grit/chromium_strings.h" |
12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
14 | 15 |
15 ExtensionGlobalError::ExtensionGlobalError( | 16 ExtensionGlobalError::ExtensionGlobalError( |
16 base::WeakPtr<ExtensionService> extension_service) | 17 base::WeakPtr<ExtensionService> extension_service) |
17 : current_browser_(NULL), | 18 : current_browser_(NULL), |
18 should_delete_self_on_close_(true), | 19 should_delete_self_on_close_(true), |
19 extension_service_(extension_service), | 20 extension_service_(extension_service), |
20 external_extension_ids_(new ExtensionIdSet), | 21 external_extension_ids_(new ExtensionIdSet), |
21 blacklisted_extension_ids_(new ExtensionIdSet), | 22 blacklisted_extension_ids_(new ExtensionIdSet), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 string16 ExtensionGlobalError::GenerateMessageSection( | 91 string16 ExtensionGlobalError::GenerateMessageSection( |
91 const ExtensionIdSet* extensions, | 92 const ExtensionIdSet* extensions, |
92 int template_message_id) { | 93 int template_message_id) { |
93 CHECK(extensions); | 94 CHECK(extensions); |
94 CHECK(template_message_id); | 95 CHECK(template_message_id); |
95 string16 message; | 96 string16 message; |
96 | 97 |
97 for (ExtensionIdSet::const_iterator iter = extensions->begin(); | 98 for (ExtensionIdSet::const_iterator iter = extensions->begin(); |
98 iter != extensions->end(); ++iter) { | 99 iter != extensions->end(); ++iter) { |
99 const Extension* e = extension_service_->GetExtensionById(*iter, true); | 100 const Extension* e = extension_service_->GetExtensionById(*iter, true); |
100 message += l10n_util::GetStringFUTF16(template_message_id, | 101 message += l10n_util::GetStringFUTF16( |
101 string16(ASCIIToUTF16(e->name()))); | 102 template_message_id, |
| 103 string16(ASCIIToUTF16(e->name())), |
| 104 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
102 } | 105 } |
103 return message; | 106 return message; |
104 } | 107 } |
105 | 108 |
106 string16 ExtensionGlobalError::GenerateMessage() { | 109 string16 ExtensionGlobalError::GenerateMessage() { |
107 if (extension_service_.get()) { | 110 if (extension_service_.get()) { |
108 return | 111 return |
109 GenerateMessageSection(external_extension_ids_.get(), | 112 GenerateMessageSection(external_extension_ids_.get(), |
110 IDS_EXTENSION_ALERT_ITEM_EXTERNAL) + | 113 IDS_EXTENSION_ALERT_ITEM_EXTERNAL) + |
111 GenerateMessageSection(blacklisted_extension_ids_.get(), | 114 GenerateMessageSection(blacklisted_extension_ids_.get(), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (!accept_callback_.is_null()) { | 148 if (!accept_callback_.is_null()) { |
146 accept_callback_.Run(*this, current_browser_); | 149 accept_callback_.Run(*this, current_browser_); |
147 } | 150 } |
148 } | 151 } |
149 | 152 |
150 void ExtensionGlobalError::BubbleViewCancelButtonPressed() { | 153 void ExtensionGlobalError::BubbleViewCancelButtonPressed() { |
151 if (!cancel_callback_.is_null()) { | 154 if (!cancel_callback_.is_null()) { |
152 cancel_callback_.Run(*this, current_browser_); | 155 cancel_callback_.Run(*this, current_browser_); |
153 } | 156 } |
154 } | 157 } |
OLD | NEW |