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

Unified Diff: chrome/browser/extensions/extension_install_ui.cc

Issue 2808051: Refactored extension privilege enumeration and implemented URLPattern compari... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_install_ui.cc
===================================================================
--- chrome/browser/extensions/extension_install_ui.cc (revision 54542)
+++ chrome/browser/extensions/extension_install_ui.cc (working copy)
@@ -30,6 +30,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_resource.h"
+#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
@@ -78,28 +79,29 @@
warnings->push_back(
l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS));
} else {
- std::set<std::string> hosts = extension->GetEffectiveHostPermissions();
+ std::vector<URLPattern> hosts =
+ extension->GetEffectiveHostPermissions().patterns();
if (hosts.size() == 1) {
warnings->push_back(
l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_1_HOST,
- UTF8ToUTF16(*hosts.begin())));
+ UTF8ToUTF16(hosts.begin()->host())));
} else if (hosts.size() == 2) {
warnings->push_back(
l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_2_HOSTS,
- UTF8ToUTF16(*hosts.begin()),
- UTF8ToUTF16(*(++hosts.begin()))));
+ UTF8ToUTF16(hosts.begin()->host()),
+ UTF8ToUTF16((++hosts.begin())->host())));
} else if (hosts.size() == 3) {
warnings->push_back(
l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_3_HOSTS,
- UTF8ToUTF16(*hosts.begin()),
- UTF8ToUTF16(*(++hosts.begin())),
- UTF8ToUTF16(*(++++hosts.begin()))));
+ UTF8ToUTF16(hosts.begin()->host()),
+ UTF8ToUTF16((++hosts.begin())->host()),
+ UTF8ToUTF16((++++hosts.begin())->host())));
} else if (hosts.size() >= 4) {
warnings->push_back(
l10n_util::GetStringFUTF16(
IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS,
- UTF8ToUTF16(*hosts.begin()),
- UTF8ToUTF16(*(++hosts.begin())),
+ UTF8ToUTF16(hosts.begin()->host()),
+ UTF8ToUTF16((++hosts.begin())->host()),
base::IntToString16(hosts.size() - 2)));
}
}
« no previous file with comments | « chrome/browser/extensions/extension_browsertests_misc.cc ('k') | chrome/browser/extensions/extension_protocols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698