OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/extensions/permissions/chrome_permission_message_provide r.h" | 5 #include "chrome/common/extensions/permissions/chrome_permission_message_provide r.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "extensions/common/extensions_client.h" | 9 #include "extensions/common/extensions_client.h" |
10 #include "extensions/common/permissions/permission_message.h" | 10 #include "extensions/common/permissions/permission_message.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 SuppressMessage(messages, | 79 SuppressMessage(messages, |
80 PermissionMessage::kBookmarks, | 80 PermissionMessage::kBookmarks, |
81 PermissionMessage::kOverrideBookmarksUI); | 81 PermissionMessage::kOverrideBookmarksUI); |
82 // Both tabs and history already allow reading favicons. | 82 // Both tabs and history already allow reading favicons. |
83 SuppressMessage(messages, | 83 SuppressMessage(messages, |
84 PermissionMessage::kTabs, | 84 PermissionMessage::kTabs, |
85 PermissionMessage::kFavicon); | 85 PermissionMessage::kFavicon); |
86 SuppressMessage(messages, | 86 SuppressMessage(messages, |
87 PermissionMessage::kBrowsingHistory, | 87 PermissionMessage::kBrowsingHistory, |
88 PermissionMessage::kFavicon); | 88 PermissionMessage::kFavicon); |
89 // Warning for history permission already covers warning for tabs permission. | 89 // Warning for history permission already covers warning for tabs and |
90 // topSites permission. | |
90 SuppressMessage(messages, | 91 SuppressMessage(messages, |
91 PermissionMessage::kBrowsingHistory, | 92 PermissionMessage::kBrowsingHistory, |
92 PermissionMessage::kTabs); | 93 PermissionMessage::kTabs); |
94 SuppressMessage(messages, | |
95 PermissionMessage::kBrowsingHistory, | |
96 PermissionMessage::kTopSites); | |
97 // Warning for topSites permission already covers warning for tabs | |
98 // permission. | |
99 SuppressMessage(messages, | |
100 PermissionMessage::kTopSites, | |
101 PermissionMessage::kTabs); | |
meacer
2014/06/11 20:03:10
See my comment below: if we just had "read browsin
| |
93 // Warning for full access permission already covers warning for tabs | 102 // Warning for full access permission already covers warning for tabs |
94 // permission. | 103 // permission. |
95 SuppressMessage(messages, | 104 SuppressMessage(messages, |
96 PermissionMessage::kHostsAll, | 105 PermissionMessage::kHostsAll, |
97 PermissionMessage::kTabs); | 106 PermissionMessage::kTabs); |
98 | 107 |
99 return messages; | 108 return messages; |
100 } | 109 } |
101 | 110 |
102 std::vector<base::string16> ChromePermissionMessageProvider::GetWarningMessages( | 111 std::vector<base::string16> ChromePermissionMessageProvider::GetWarningMessages( |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_DELETE; | 164 IDS_EXTENSION_PROMPT_WARNING_MEDIA_GALLERIES_READ_DELETE; |
156 message_strings.push_back(l10n_util::GetStringUTF16(m_id)); | 165 message_strings.push_back(l10n_util::GetStringUTF16(m_id)); |
157 continue; | 166 continue; |
158 } else if (id == PermissionMessage::kMediaGalleriesAllGalleriesCopyTo || | 167 } else if (id == PermissionMessage::kMediaGalleriesAllGalleriesCopyTo || |
159 id == PermissionMessage::kMediaGalleriesAllGalleriesDelete) { | 168 id == PermissionMessage::kMediaGalleriesAllGalleriesDelete) { |
160 // The combined message will be pushed above. | 169 // The combined message will be pushed above. |
161 continue; | 170 continue; |
162 } | 171 } |
163 } | 172 } |
164 if (permissions->HasAPIPermission(APIPermission::kSessions) && | 173 if (permissions->HasAPIPermission(APIPermission::kSessions) && |
165 id == PermissionMessage::kTabs) { | 174 (id == PermissionMessage::kTabs || |
175 id == PermissionMessage::kTopSites)) { | |
166 message_strings.push_back(l10n_util::GetStringUTF16( | 176 message_strings.push_back(l10n_util::GetStringUTF16( |
167 IDS_EXTENSION_PROMPT_WARNING_TABS_AND_SESSIONS)); | 177 IDS_EXTENSION_PROMPT_WARNING_TABS_AND_SESSIONS)); |
meacer
2014/06/11 20:03:10
This is getting a bit complicated. The warning for
wjywbs
2014/06/11 23:43:18
The "tabs" API does not have any access to the his
meacer
2014/06/12 00:05:08
I mean, it kind of does, depending on one's defini
| |
168 continue; | 178 continue; |
169 } | 179 } |
170 if (permissions->HasAPIPermission(APIPermission::kSessions) && | 180 if (permissions->HasAPIPermission(APIPermission::kSessions) && |
171 id == PermissionMessage::kBrowsingHistory) { | 181 id == PermissionMessage::kBrowsingHistory) { |
172 message_strings.push_back(l10n_util::GetStringUTF16( | 182 message_strings.push_back(l10n_util::GetStringUTF16( |
173 IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY_AND_SESSIONS)); | 183 IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY_AND_SESSIONS)); |
174 continue; | 184 continue; |
175 } | 185 } |
176 | 186 |
177 message_strings.push_back(i->message()); | 187 message_strings.push_back(i->message()); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 std::set<std::string> old_hosts_set( | 377 std::set<std::string> old_hosts_set( |
368 permission_message_util::GetDistinctHosts(old_list, false, false)); | 378 permission_message_util::GetDistinctHosts(old_list, false, false)); |
369 std::set<std::string> new_hosts_only = | 379 std::set<std::string> new_hosts_only = |
370 base::STLSetDifference<std::set<std::string> >(new_hosts_set, | 380 base::STLSetDifference<std::set<std::string> >(new_hosts_set, |
371 old_hosts_set); | 381 old_hosts_set); |
372 | 382 |
373 return !new_hosts_only.empty(); | 383 return !new_hosts_only.empty(); |
374 } | 384 } |
375 | 385 |
376 } // namespace extensions | 386 } // namespace extensions |
OLD | NEW |