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

Side by Side Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/extensions/extension_tabs_module.h" 5 #include "chrome/browser/extensions/extension_tabs_module.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 768
769 if (!url.is_valid()) { 769 if (!url.is_valid()) {
770 error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kInvalidUrlError, 770 error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kInvalidUrlError,
771 url_string); 771 url_string);
772 return false; 772 return false;
773 } 773 }
774 774
775 // JavaScript URLs can do the same kinds of things as cross-origin XHR, so 775 // JavaScript URLs can do the same kinds of things as cross-origin XHR, so
776 // we need to check host permissions before allowing them. 776 // we need to check host permissions before allowing them.
777 if (url.SchemeIs(chrome::kJavaScriptScheme)) { 777 if (url.SchemeIs(chrome::kJavaScriptScheme)) {
778 const Extension* extension = GetExtension(); 778 if (!GetExtension()->CanExecuteScriptOnPage(
779 const std::vector<URLPattern> host_permissions = 779 contents->tab_contents()->GetURL(), NULL, &error_)) {
780 extension->host_permissions();
781 if (!Extension::CanExecuteScriptOnPage(
782 contents->tab_contents()->GetURL(),
783 extension->CanExecuteScriptEverywhere(),
784 &host_permissions,
785 NULL,
786 &error_)) {
787 return false; 780 return false;
788 } 781 }
789 782
790 // TODO(aa): How does controller queue URLs? Is there any chance that this 783 // TODO(aa): How does controller queue URLs? Is there any chance that this
791 // JavaScript URL will end up applying to something other than 784 // JavaScript URL will end up applying to something other than
792 // controller->GetURL()? 785 // controller->GetURL()?
793 } 786 }
794 787
795 controller.LoadURL(url, GURL(), PageTransition::LINK); 788 controller.LoadURL(url, GURL(), PageTransition::LINK);
796 789
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } 1230 }
1238 1231
1239 static GURL ResolvePossiblyRelativeURL(std::string url_string, 1232 static GURL ResolvePossiblyRelativeURL(std::string url_string,
1240 const Extension* extension) { 1233 const Extension* extension) {
1241 GURL url = GURL(url_string); 1234 GURL url = GURL(url_string);
1242 if (!url.is_valid()) 1235 if (!url.is_valid())
1243 url = extension->GetResourceURL(url_string); 1236 url = extension->GetResourceURL(url_string);
1244 1237
1245 return url; 1238 return url;
1246 } 1239 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/execute_code_in_tab_function.cc ('k') | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698