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

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

Issue 2409423005: Compare GURLs to kUrlConstants with .spec() and string equality (Closed)
Patch Set: rebase on dependent patch Created 4 years, 2 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/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 9 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 page_origin == extension->url(); 87 page_origin == extension->url();
88 // - devtools (chrome-extension:// URLs are loaded into frames of devtools 88 // - devtools (chrome-extension:// URLs are loaded into frames of devtools
89 // to support the devtools extension APIs) 89 // to support the devtools extension APIs)
90 bool is_dev_tools = 90 bool is_dev_tools =
91 page_origin.SchemeIs(content::kChromeDevToolsScheme) && 91 page_origin.SchemeIs(content::kChromeDevToolsScheme) &&
92 !chrome_manifest_urls::GetDevToolsPage(extension).is_empty(); 92 !chrome_manifest_urls::GetDevToolsPage(extension).is_empty();
93 bool transition_allowed = 93 bool transition_allowed =
94 !ui::PageTransitionIsWebTriggerable(transition_type); 94 !ui::PageTransitionIsWebTriggerable(transition_type);
95 // - unreachable web page error page (to allow showing the icon of the 95 // - unreachable web page error page (to allow showing the icon of the
96 // unreachable app on this page) 96 // unreachable app on this page)
97 bool is_error_page = frame_url == GURL(content::kUnreachableWebDataURL); 97 bool is_error_page = frame_url == content::kUnreachableWebDataURL;
98 98
99 if (!is_empty_origin && !is_own_resource && 99 if (!is_empty_origin && !is_own_resource &&
100 !is_dev_tools && !transition_allowed && !is_error_page) { 100 !is_dev_tools && !transition_allowed && !is_error_page) {
101 std::string message = base::StringPrintf( 101 std::string message = base::StringPrintf(
102 "Denying load of %s. Resources must be listed in the " 102 "Denying load of %s. Resources must be listed in the "
103 "web_accessible_resources manifest key in order to be loaded by " 103 "web_accessible_resources manifest key in order to be loaded by "
104 "pages outside the extension.", 104 "pages outside the extension.",
105 resource_url.spec().c_str()); 105 resource_url.spec().c_str());
106 frame->addMessageToConsole( 106 frame->addMessageToConsole(
107 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError, 107 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError,
(...skipping 19 matching lines...) Expand all
127 frame->addMessageToConsole( 127 frame->addMessageToConsole(
128 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError, 128 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError,
129 blink::WebString::fromUTF8(message))); 129 blink::WebString::fromUTF8(message)));
130 return false; 130 return false;
131 } 131 }
132 132
133 return true; 133 return true;
134 } 134 }
135 135
136 } // namespace extensions 136 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer.cc ('k') | chrome/renderer/printing/chrome_print_web_view_helper_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698