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

Side by Side Diff: chrome/renderer/extensions/resource_request_policy.cc

Issue 11786003: Move Icons out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: License year update Created 7 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/renderer/extensions/resource_request_policy.h" 5 #include "chrome/renderer/extensions/resource_request_policy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/common/extensions/api/icons/icons_handler.h"
11 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_set.h" 13 #include "chrome/common/extensions/extension_set.h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
14 #include "content/public/common/page_transition_types.h" 15 #include "content/public/common/page_transition_types.h"
15 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
16 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
(...skipping 16 matching lines...) Expand all
37 return true; 38 return true;
38 } 39 }
39 40
40 // Disallow loading of packaged resources for hosted apps. We don't allow 41 // Disallow loading of packaged resources for hosted apps. We don't allow
41 // hybrid hosted/packaged apps. The one exception is access to icons, since 42 // hybrid hosted/packaged apps. The one exception is access to icons, since
42 // some extensions want to be able to do things like create their own 43 // some extensions want to be able to do things like create their own
43 // launchers. 44 // launchers.
44 std::string resource_root_relative_path = 45 std::string resource_root_relative_path =
45 resource_url.path().empty() ? "" : resource_url.path().substr(1); 46 resource_url.path().empty() ? "" : resource_url.path().substr(1);
46 if (extension->is_hosted_app() && 47 if (extension->is_hosted_app() &&
47 !extension->icons().ContainsPath(resource_root_relative_path)) { 48 !IconsInfo::GetIcons(extension)
49 .ContainsPath(resource_root_relative_path)) {
48 LOG(ERROR) << "Denying load of " << resource_url.spec() << " from " 50 LOG(ERROR) << "Denying load of " << resource_url.spec() << " from "
49 << "hosted app."; 51 << "hosted app.";
50 return false; 52 return false;
51 } 53 }
52 54
53 // Disallow loading of extension resources which are not explicitely listed 55 // Disallow loading of extension resources which are not explicitely listed
54 // as web accessible if the manifest version is 2 or greater. 56 // as web accessible if the manifest version is 2 or greater.
55 if (!extension->IsResourceWebAccessible(resource_url.path()) && 57 if (!extension->IsResourceWebAccessible(resource_url.path()) &&
56 !CommandLine::ForCurrentProcess()->HasSwitch( 58 !CommandLine::ForCurrentProcess()->HasSwitch(
57 switches::kDisableExtensionsResourceWhitelist)) { 59 switches::kDisableExtensionsResourceWhitelist)) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return false; 113 return false;
112 } 114 }
113 115
114 return true; 116 return true;
115 } 117 }
116 118
117 ResourceRequestPolicy::ResourceRequestPolicy() { 119 ResourceRequestPolicy::ResourceRequestPolicy() {
118 } 120 }
119 121
120 } // namespace extensions 122 } // namespace extensions
OLDNEW
« chrome/common/extensions/api/icons/icons_handler.cc ('K') | « chrome/common/localized_error.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698