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

Side by Side Diff: chrome/common/extensions/chrome_extensions_client.cc

Issue 1213623006: Extensions: Remove PermissionMessage (permission_message.h/cc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kill_getmessages
Patch Set: fix app_shell build, rebase Created 5 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
OLDNEW
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/chrome_extensions_client.h" 5 #include "chrome/common/extensions/chrome_extensions_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 25 matching lines...) Expand all
36 #include "extensions/common/features/behavior_feature.h" 36 #include "extensions/common/features/behavior_feature.h"
37 #include "extensions/common/features/feature_provider.h" 37 #include "extensions/common/features/feature_provider.h"
38 #include "extensions/common/features/json_feature_provider_source.h" 38 #include "extensions/common/features/json_feature_provider_source.h"
39 #include "extensions/common/features/manifest_feature.h" 39 #include "extensions/common/features/manifest_feature.h"
40 #include "extensions/common/features/permission_feature.h" 40 #include "extensions/common/features/permission_feature.h"
41 #include "extensions/common/features/simple_feature.h" 41 #include "extensions/common/features/simple_feature.h"
42 #include "extensions/common/manifest_constants.h" 42 #include "extensions/common/manifest_constants.h"
43 #include "extensions/common/manifest_handler.h" 43 #include "extensions/common/manifest_handler.h"
44 #include "extensions/common/manifest_handlers/icons_handler.h" 44 #include "extensions/common/manifest_handlers/icons_handler.h"
45 #include "extensions/common/permissions/api_permission_set.h" 45 #include "extensions/common/permissions/api_permission_set.h"
46 #include "extensions/common/permissions/permission_message.h"
47 #include "extensions/common/permissions/permissions_info.h" 46 #include "extensions/common/permissions/permissions_info.h"
48 #include "extensions/common/url_pattern.h" 47 #include "extensions/common/url_pattern.h"
49 #include "extensions/common/url_pattern_set.h" 48 #include "extensions/common/url_pattern_set.h"
50 #include "extensions/grit/extensions_resources.h" 49 #include "extensions/grit/extensions_resources.h"
51 #include "ui/base/l10n/l10n_util.h" 50 #include "ui/base/l10n/l10n_util.h"
52 #include "url/gurl.h" 51 #include "url/gurl.h"
53 52
54 namespace extensions { 53 namespace extensions {
55 54
56 namespace { 55 namespace {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } else { 184 } else {
186 NOTREACHED(); 185 NOTREACHED();
187 source.reset(); 186 source.reset();
188 } 187 }
189 return source.Pass(); 188 return source.Pass();
190 } 189 }
191 190
192 void ChromeExtensionsClient::FilterHostPermissions( 191 void ChromeExtensionsClient::FilterHostPermissions(
193 const URLPatternSet& hosts, 192 const URLPatternSet& hosts,
194 URLPatternSet* new_hosts, 193 URLPatternSet* new_hosts,
195 std::set<PermissionMessage>* messages) const {
196 // When editing this function, be sure to add the same functionality to
197 // FilterHostPermissions() below.
198 // TODO(sashab): Deprecate and remove this function.
199 for (URLPatternSet::const_iterator i = hosts.begin();
200 i != hosts.end(); ++i) {
201 // Filters out every URL pattern that matches chrome:// scheme.
202 if (i->scheme() == content::kChromeUIScheme) {
203 // chrome://favicon is the only URL for chrome:// scheme that we
204 // want to support. We want to deprecate the "chrome" scheme.
205 // We should not add any additional "host" here.
206 if (GURL(chrome::kChromeUIFaviconURL).host() != i->host())
207 continue;
208 messages->insert(PermissionMessage(
209 PermissionMessage::kFavicon,
210 l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WARNING_FAVICON)));
211 } else {
212 new_hosts->AddPattern(*i);
213 }
214 }
215 }
216
217 void ChromeExtensionsClient::FilterHostPermissions(
218 const URLPatternSet& hosts,
219 URLPatternSet* new_hosts,
220 PermissionIDSet* permissions) const { 194 PermissionIDSet* permissions) const {
221 // When editing this function, be sure to add the same functionality to 195 // When editing this function, be sure to add the same functionality to
222 // FilterHostPermissions() above. 196 // FilterHostPermissions() above.
223 for (URLPatternSet::const_iterator i = hosts.begin(); i != hosts.end(); ++i) { 197 for (URLPatternSet::const_iterator i = hosts.begin(); i != hosts.end(); ++i) {
224 // Filters out every URL pattern that matches chrome:// scheme. 198 // Filters out every URL pattern that matches chrome:// scheme.
225 if (i->scheme() == content::kChromeUIScheme) { 199 if (i->scheme() == content::kChromeUIScheme) {
226 // chrome://favicon is the only URL for chrome:// scheme that we 200 // chrome://favicon is the only URL for chrome:// scheme that we
227 // want to support. We want to deprecate the "chrome" scheme. 201 // want to support. We want to deprecate the "chrome" scheme.
228 // We should not add any additional "host" here. 202 // We should not add any additional "host" here.
229 if (GURL(chrome::kChromeUIFaviconURL).host() != i->host()) 203 if (GURL(chrome::kChromeUIFaviconURL).host() != i->host())
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 376
403 return image_paths; 377 return image_paths;
404 } 378 }
405 379
406 // static 380 // static
407 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { 381 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() {
408 return g_client.Pointer(); 382 return g_client.Pointer();
409 } 383 }
410 384
411 } // namespace extensions 385 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/chrome_extensions_client.h ('k') | chrome/common/extensions/manifest_handlers/automation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698