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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_install_ui.h" 5 #include "chrome/browser/extensions/extension_install_ui.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 12 matching lines...) Expand all
23 #if defined(TOOLKIT_VIEWS) 23 #if defined(TOOLKIT_VIEWS)
24 #include "chrome/browser/views/app_launcher.h" 24 #include "chrome/browser/views/app_launcher.h"
25 #include "chrome/browser/views/extensions/extension_installed_bubble.h" 25 #include "chrome/browser/views/extensions/extension_installed_bubble.h"
26 #elif defined(TOOLKIT_GTK) 26 #elif defined(TOOLKIT_GTK)
27 #include "chrome/browser/gtk/extension_installed_bubble_gtk.h" 27 #include "chrome/browser/gtk/extension_installed_bubble_gtk.h"
28 #endif 28 #endif
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/extensions/extension.h" 30 #include "chrome/common/extensions/extension.h"
31 #include "chrome/common/extensions/extension_action.h" 31 #include "chrome/common/extensions/extension_action.h"
32 #include "chrome/common/extensions/extension_resource.h" 32 #include "chrome/common/extensions/extension_resource.h"
33 #include "chrome/common/extensions/url_pattern.h"
33 #include "chrome/common/notification_service.h" 34 #include "chrome/common/notification_service.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "grit/browser_resources.h" 36 #include "grit/browser_resources.h"
36 #include "grit/chromium_strings.h" 37 #include "grit/chromium_strings.h"
37 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
38 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
39 40
40 #if defined(TOOLKIT_GTK) 41 #if defined(TOOLKIT_GTK)
41 #include "chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h" 42 #include "chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h"
42 #include "chrome/browser/gtk/gtk_theme_provider.h" 43 #include "chrome/browser/gtk/gtk_theme_provider.h"
(...skipping 28 matching lines...) Expand all
71 // presentation for this case? 72 // presentation for this case?
72 warnings->push_back( 73 warnings->push_back(
73 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS)); 74 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS));
74 return; 75 return;
75 } 76 }
76 77
77 if (extension->HasAccessToAllHosts()) { 78 if (extension->HasAccessToAllHosts()) {
78 warnings->push_back( 79 warnings->push_back(
79 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS)); 80 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS));
80 } else { 81 } else {
81 std::set<std::string> hosts = extension->GetEffectiveHostPermissions(); 82 std::vector<URLPattern> hosts =
83 extension->GetEffectiveHostPermissions().patterns();
82 if (hosts.size() == 1) { 84 if (hosts.size() == 1) {
83 warnings->push_back( 85 warnings->push_back(
84 l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_1_HOST, 86 l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_1_HOST,
85 UTF8ToUTF16(*hosts.begin()))); 87 UTF8ToUTF16(hosts.begin()->host())));
86 } else if (hosts.size() == 2) { 88 } else if (hosts.size() == 2) {
87 warnings->push_back( 89 warnings->push_back(
88 l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_2_HOSTS, 90 l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_2_HOSTS,
89 UTF8ToUTF16(*hosts.begin()), 91 UTF8ToUTF16(hosts.begin()->host()),
90 UTF8ToUTF16(*(++hosts.begin())))); 92 UTF8ToUTF16((++hosts.begin())->host())));
91 } else if (hosts.size() == 3) { 93 } else if (hosts.size() == 3) {
92 warnings->push_back( 94 warnings->push_back(
93 l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_3_HOSTS, 95 l10n_util::GetStringFUTF16(IDS_EXTENSION_PROMPT2_WARNING_3_HOSTS,
94 UTF8ToUTF16(*hosts.begin()), 96 UTF8ToUTF16(hosts.begin()->host()),
95 UTF8ToUTF16(*(++hosts.begin())), 97 UTF8ToUTF16((++hosts.begin())->host()),
96 UTF8ToUTF16(*(++++hosts.begin())))); 98 UTF8ToUTF16((++++hosts.begin())->host())));
97 } else if (hosts.size() >= 4) { 99 } else if (hosts.size() >= 4) {
98 warnings->push_back( 100 warnings->push_back(
99 l10n_util::GetStringFUTF16( 101 l10n_util::GetStringFUTF16(
100 IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS, 102 IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS,
101 UTF8ToUTF16(*hosts.begin()), 103 UTF8ToUTF16(hosts.begin()->host()),
102 UTF8ToUTF16(*(++hosts.begin())), 104 UTF8ToUTF16((++hosts.begin())->host()),
103 base::IntToString16(hosts.size() - 2))); 105 base::IntToString16(hosts.size() - 2)));
104 } 106 }
105 } 107 }
106 108
107 if (extension->HasEffectiveBrowsingHistoryPermission()) { 109 if (extension->HasEffectiveBrowsingHistoryPermission()) {
108 warnings->push_back( 110 warnings->push_back(
109 l10n_util::GetStringUTF16( 111 l10n_util::GetStringUTF16(
110 IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY)); 112 IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY));
111 } 113 }
112 114
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 TabContents* tab_contents, Extension* new_theme, 365 TabContents* tab_contents, Extension* new_theme,
364 const std::string& previous_theme_id, bool previous_use_system_theme) { 366 const std::string& previous_theme_id, bool previous_use_system_theme) {
365 #if defined(TOOLKIT_GTK) 367 #if defined(TOOLKIT_GTK)
366 return new GtkThemeInstalledInfoBarDelegate(tab_contents, new_theme, 368 return new GtkThemeInstalledInfoBarDelegate(tab_contents, new_theme,
367 previous_theme_id, previous_use_system_theme); 369 previous_theme_id, previous_use_system_theme);
368 #else 370 #else
369 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, 371 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme,
370 previous_theme_id); 372 previous_theme_id);
371 #endif 373 #endif
372 } 374 }
OLDNEW
« 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