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