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

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: Created 7 years, 10 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) 2012 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/extensions/manifest_url_handler.h" 14 #include "chrome/common/extensions/manifest_url_handler.h"
14 #include "chrome/common/extensions/web_accessible_resources_handler.h" 15 #include "chrome/common/extensions/web_accessible_resources_handler.h"
15 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
16 #include "content/public/common/page_transition_types.h" 17 #include "content/public/common/page_transition_types.h"
17 #include "extensions/common/constants.h" 18 #include "extensions/common/constants.h"
18 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
(...skipping 18 matching lines...) Expand all
39 return true; 40 return true;
40 } 41 }
41 42
42 // Disallow loading of packaged resources for hosted apps. We don't allow 43 // Disallow loading of packaged resources for hosted apps. We don't allow
43 // hybrid hosted/packaged apps. The one exception is access to icons, since 44 // hybrid hosted/packaged apps. The one exception is access to icons, since
44 // some extensions want to be able to do things like create their own 45 // some extensions want to be able to do things like create their own
45 // launchers. 46 // launchers.
46 std::string resource_root_relative_path = 47 std::string resource_root_relative_path =
47 resource_url.path().empty() ? "" : resource_url.path().substr(1); 48 resource_url.path().empty() ? "" : resource_url.path().substr(1);
48 if (extension->is_hosted_app() && 49 if (extension->is_hosted_app() &&
49 !extension->icons().ContainsPath(resource_root_relative_path)) { 50 !IconsInfo::GetIcons(extension)
51 .ContainsPath(resource_root_relative_path)) {
50 LOG(ERROR) << "Denying load of " << resource_url.spec() << " from " 52 LOG(ERROR) << "Denying load of " << resource_url.spec() << " from "
51 << "hosted app."; 53 << "hosted app.";
52 return false; 54 return false;
53 } 55 }
54 56
55 // Disallow loading of extension resources which are not explicitly listed 57 // Disallow loading of extension resources which are not explicitly listed
56 // as web accessible if the manifest version is 2 or greater. 58 // as web accessible if the manifest version is 2 or greater.
57 if (!WebAccessibleResourcesInfo::IsResourceWebAccessible( 59 if (!WebAccessibleResourcesInfo::IsResourceWebAccessible(
58 extension, resource_url.path()) && 60 extension, resource_url.path()) &&
59 !CommandLine::ForCurrentProcess()->HasSwitch( 61 !CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return false; 116 return false;
115 } 117 }
116 118
117 return true; 119 return true;
118 } 120 }
119 121
120 ResourceRequestPolicy::ResourceRequestPolicy() { 122 ResourceRequestPolicy::ResourceRequestPolicy() {
121 } 123 }
122 124
123 } // namespace extensions 125 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698