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

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

Issue 11742005: Move [Homepage,Options,Update,DevTools]URL out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: 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
« no previous file with comments | « chrome/common/extensions/permissions/permission_set.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extension_urls/extension_urls_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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Exceptions are: 62 // Exceptions are:
62 // - empty origin (needed for some edge cases when we have empty origins) 63 // - empty origin (needed for some edge cases when we have empty origins)
63 bool is_empty_origin = frame_url.is_empty(); 64 bool is_empty_origin = frame_url.is_empty();
64 // - extensions requesting their own resources (frame_url check is for 65 // - extensions requesting their own resources (frame_url check is for
65 // images, page_url check is for iframes) 66 // images, page_url check is for iframes)
66 bool is_own_resource = frame_url.GetOrigin() == extension->url() || 67 bool is_own_resource = frame_url.GetOrigin() == extension->url() ||
67 page_url.GetOrigin() == extension->url(); 68 page_url.GetOrigin() == extension->url();
68 // - devtools (chrome-extension:// URLs are loaded into frames of devtools 69 // - devtools (chrome-extension:// URLs are loaded into frames of devtools
69 // to support the devtools extension APIs) 70 // to support the devtools extension APIs)
70 bool is_dev_tools = page_url.SchemeIs(chrome::kChromeDevToolsScheme) && 71 bool is_dev_tools = page_url.SchemeIs(chrome::kChromeDevToolsScheme) &&
71 !extension->devtools_url().is_empty(); 72 !ExtensionURL::GetDevToolsURL(extension).is_empty();
72 bool transition_allowed = 73 bool transition_allowed =
73 !content::PageTransitionIsWebTriggerable(transition_type); 74 !content::PageTransitionIsWebTriggerable(transition_type);
74 // - unreachable web page error page (to allow showing the icon of the 75 // - unreachable web page error page (to allow showing the icon of the
75 // unreachable app on this page) 76 // unreachable app on this page)
76 bool is_error_page = frame_url == GURL(content::kUnreachableWebDataURL); 77 bool is_error_page = frame_url == GURL(content::kUnreachableWebDataURL);
77 78
78 if (!is_empty_origin && !is_own_resource && 79 if (!is_empty_origin && !is_own_resource &&
79 !is_dev_tools && !transition_allowed && !is_error_page) { 80 !is_dev_tools && !transition_allowed && !is_error_page) {
80 std::string message = base::StringPrintf( 81 std::string message = base::StringPrintf(
81 "Denying load of %s. Resources must be listed in the " 82 "Denying load of %s. Resources must be listed in the "
(...skipping 29 matching lines...) Expand all
111 return false; 112 return false;
112 } 113 }
113 114
114 return true; 115 return true;
115 } 116 }
116 117
117 ResourceRequestPolicy::ResourceRequestPolicy() { 118 ResourceRequestPolicy::ResourceRequestPolicy() {
118 } 119 }
119 120
120 } // namespace extensions 121 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/permission_set.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698