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

Side by Side Diff: chrome/browser/extensions/extension_error_ui.cc

Issue 10905188: Have different text for apps and regular extensions in some more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (and make it actually compile) Created 8 years, 3 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
« no previous file with comments | « chrome/browser/extensions/extension_error_ui.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/extension_error_ui.h" 5 #include "chrome/browser/extensions/extension_error_ui.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 22 matching lines...) Expand all
33 void ExtensionErrorUI::AddBlacklistedExtension(const std::string& id) { 33 void ExtensionErrorUI::AddBlacklistedExtension(const std::string& id) {
34 blacklisted_extension_ids_->insert(id); 34 blacklisted_extension_ids_->insert(id);
35 } 35 }
36 36
37 void ExtensionErrorUI::AddOrphanedExtension(const std::string& id) { 37 void ExtensionErrorUI::AddOrphanedExtension(const std::string& id) {
38 orphaned_extension_ids_->insert(id); 38 orphaned_extension_ids_->insert(id);
39 } 39 }
40 40
41 string16 ExtensionErrorUI::GenerateMessageSection( 41 string16 ExtensionErrorUI::GenerateMessageSection(
42 const ExtensionIdSet* extensions, 42 const ExtensionIdSet* extensions,
43 int template_message_id) { 43 int extension_template_message_id,
44 int app_template_message_id) {
44 CHECK(extensions); 45 CHECK(extensions);
45 CHECK(template_message_id); 46 CHECK(extension_template_message_id);
47 CHECK(app_template_message_id);
46 string16 message; 48 string16 message;
47 49
48 for (ExtensionIdSet::const_iterator iter = extensions->begin(); 50 for (ExtensionIdSet::const_iterator iter = extensions->begin();
49 iter != extensions->end(); ++iter) { 51 iter != extensions->end(); ++iter) {
50 const extensions::Extension* e = extension_service_->GetExtensionById(*iter, 52 const extensions::Extension* e = extension_service_->GetExtensionById(*iter,
51 true); 53 true);
52 message += l10n_util::GetStringFUTF16(template_message_id, 54 message += l10n_util::GetStringFUTF16(
53 UTF8ToUTF16(e->name())); 55 e->is_app() ? app_template_message_id : extension_template_message_id,
56 UTF8ToUTF16(e->name())) + char16('\n');
54 } 57 }
55 return message; 58 return message;
56 } 59 }
57 60
58 string16 ExtensionErrorUI::GenerateMessage() { 61 string16 ExtensionErrorUI::GenerateMessage() {
59 return GenerateMessageSection(external_extension_ids_.get(), 62 return GenerateMessageSection(external_extension_ids_.get(),
60 IDS_EXTENSION_ALERT_ITEM_EXTERNAL) + 63 IDS_EXTENSION_ALERT_ITEM_EXTERNAL,
64 IDS_APP_ALERT_ITEM_EXTERNAL) +
61 GenerateMessageSection(blacklisted_extension_ids_.get(), 65 GenerateMessageSection(blacklisted_extension_ids_.get(),
62 IDS_EXTENSION_ALERT_ITEM_BLACKLISTED) + 66 IDS_EXTENSION_ALERT_ITEM_BLACKLISTED,
67 IDS_APP_ALERT_ITEM_BLACKLISTED) +
63 GenerateMessageSection(orphaned_extension_ids_.get(), 68 GenerateMessageSection(orphaned_extension_ids_.get(),
64 IDS_EXTENSION_ALERT_ITEM_ORPHANED); 69 IDS_EXTENSION_ALERT_ITEM_ORPHANED,
70 IDS_APP_ALERT_ITEM_ORPHANED);
65 } 71 }
66 72
67 string16 ExtensionErrorUI::GetBubbleViewMessage() { 73 string16 ExtensionErrorUI::GetBubbleViewMessage() {
68 if (message_.empty()) { 74 if (message_.empty()) {
69 message_ = GenerateMessage(); 75 message_ = GenerateMessage();
70 if (message_[message_.size()-1] == '\n') 76 if (message_[message_.size()-1] == '\n')
71 message_.resize(message_.size()-1); 77 message_.resize(message_.size()-1);
72 } 78 }
73 return message_; 79 return message_;
74 } 80 }
(...skipping 15 matching lines...) Expand all
90 extension_service_->HandleExtensionAlertClosed(); 96 extension_service_->HandleExtensionAlertClosed();
91 } 97 }
92 98
93 void ExtensionErrorUI::BubbleViewAcceptButtonPressed() { 99 void ExtensionErrorUI::BubbleViewAcceptButtonPressed() {
94 extension_service_->HandleExtensionAlertAccept(); 100 extension_service_->HandleExtensionAlertAccept();
95 } 101 }
96 102
97 void ExtensionErrorUI::BubbleViewCancelButtonPressed() { 103 void ExtensionErrorUI::BubbleViewCancelButtonPressed() {
98 extension_service_->HandleExtensionAlertDetails(); 104 extension_service_->HandleExtensionAlertDetails();
99 } 105 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_error_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698