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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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/browser/extensions/api/tabs/tabs_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 } 1166 }
1167 1167
1168 // Don't let the extension crash the browser or renderers. 1168 // Don't let the extension crash the browser or renderers.
1169 if (ExtensionTabUtil::IsCrashURL(url)) { 1169 if (ExtensionTabUtil::IsCrashURL(url)) {
1170 error_ = keys::kNoCrashBrowserError; 1170 error_ = keys::kNoCrashBrowserError;
1171 return false; 1171 return false;
1172 } 1172 }
1173 1173
1174 // JavaScript URLs can do the same kinds of things as cross-origin XHR, so 1174 // JavaScript URLs can do the same kinds of things as cross-origin XHR, so
1175 // we need to check host permissions before allowing them. 1175 // we need to check host permissions before allowing them.
1176 if (url.SchemeIs(content::kJavaScriptScheme)) { 1176 if (url.SchemeIs(url::kJavaScriptScheme)) {
1177 content::RenderProcessHost* process = web_contents_->GetRenderProcessHost(); 1177 content::RenderProcessHost* process = web_contents_->GetRenderProcessHost();
1178 if (!PermissionsData::CanExecuteScriptOnPage( 1178 if (!PermissionsData::CanExecuteScriptOnPage(
1179 GetExtension(), 1179 GetExtension(),
1180 web_contents_->GetURL(), 1180 web_contents_->GetURL(),
1181 web_contents_->GetURL(), 1181 web_contents_->GetURL(),
1182 tab_id, 1182 tab_id,
1183 NULL, 1183 NULL,
1184 process ? process->GetID() : -1, 1184 process ? process->GetID() : -1,
1185 &error_)) { 1185 &error_)) {
1186 return false; 1186 return false;
(...skipping 15 matching lines...) Expand all
1202 1202
1203 *is_async = true; 1203 *is_async = true;
1204 return true; 1204 return true;
1205 } 1205 }
1206 1206
1207 web_contents_->GetController().LoadURL( 1207 web_contents_->GetController().LoadURL(
1208 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 1208 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
1209 1209
1210 // The URL of a tab contents never actually changes to a JavaScript URL, so 1210 // The URL of a tab contents never actually changes to a JavaScript URL, so
1211 // this check only makes sense in other cases. 1211 // this check only makes sense in other cases.
1212 if (!url.SchemeIs(content::kJavaScriptScheme)) 1212 if (!url.SchemeIs(url::kJavaScriptScheme))
1213 DCHECK_EQ(url.spec(), web_contents_->GetURL().spec()); 1213 DCHECK_EQ(url.spec(), web_contents_->GetURL().spec());
1214 1214
1215 return true; 1215 return true;
1216 } 1216 }
1217 1217
1218 void TabsUpdateFunction::PopulateResult() { 1218 void TabsUpdateFunction::PopulateResult() {
1219 if (!has_callback()) 1219 if (!has_callback())
1220 return; 1220 return;
1221 1221
1222 SetResult(ExtensionTabUtil::CreateTabValue(web_contents_, GetExtension())); 1222 SetResult(ExtensionTabUtil::CreateTabValue(web_contents_, GetExtension()));
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 execute_tab_id_ = tab_id; 1735 execute_tab_id_ = tab_id;
1736 details_ = details.Pass(); 1736 details_ = details.Pass();
1737 return true; 1737 return true;
1738 } 1738 }
1739 1739
1740 bool TabsInsertCSSFunction::ShouldInsertCSS() const { 1740 bool TabsInsertCSSFunction::ShouldInsertCSS() const {
1741 return true; 1741 return true;
1742 } 1742 }
1743 1743
1744 } // namespace extensions 1744 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698