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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 9369009: Make content::ResourceContext be a real interface like the rest of the Content API (i.e. don't ha... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
===================================================================
--- chrome/browser/chrome_content_browser_client.cc (revision 121250)
+++ chrome/browser/chrome_content_browser_client.cc (working copy)
@@ -722,10 +722,9 @@
bool ChromeContentBrowserClient::AllowAppCache(
const GURL& manifest_url,
const GURL& first_party,
- const content::ResourceContext& context) {
+ content::ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
return io_data->GetCookieSettings()->
IsSettingCookieAllowed(manifest_url, first_party);
}
@@ -734,12 +733,11 @@
const GURL& url,
const GURL& first_party,
const net::CookieList& cookie_list,
- const content::ResourceContext& context,
+ content::ResourceContext* context,
int render_process_id,
int render_view_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
bool allow = io_data->GetCookieSettings()->
IsReadingCookieAllowed(url, first_party);
@@ -754,14 +752,12 @@
const GURL& url,
const GURL& first_party,
const std::string& cookie_line,
- const content::ResourceContext& context,
+ content::ResourceContext* context,
int render_process_id,
int render_view_id,
net::CookieOptions* options) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
-
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
CookieSettings* cookie_settings = io_data->GetCookieSettings();
bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party);
@@ -776,10 +772,9 @@
}
bool ChromeContentBrowserClient::AllowSaveLocalState(
- const content::ResourceContext& context) {
+ content::ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
return !io_data->clear_local_state_on_exit()->GetValue();
}
@@ -788,11 +783,10 @@
const string16& name,
const string16& display_name,
unsigned long estimated_size,
- const content::ResourceContext& context,
+ content::ResourceContext* context,
const std::vector<std::pair<int, int> >& render_views) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>(
- context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
CookieSettings* cookie_settings = io_data->GetCookieSettings();
bool allow = cookie_settings->IsSettingCookieAllowed(url, url);
@@ -810,11 +804,10 @@
bool ChromeContentBrowserClient::AllowWorkerFileSystem(
const GURL& url,
- const content::ResourceContext& context,
+ content::ResourceContext* context,
const std::vector<std::pair<int, int> >& render_views) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data = reinterpret_cast<ProfileIOData*>(
- context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
CookieSettings* cookie_settings = io_data->GetCookieSettings();
bool allow = cookie_settings->IsSettingCookieAllowed(url, url);
@@ -832,11 +825,10 @@
net::URLRequestContext*
ChromeContentBrowserClient::OverrideRequestContextForURL(
- const GURL& url, const content::ResourceContext& context) {
+ const GURL& url, content::ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (url.SchemeIs(chrome::kExtensionScheme)) {
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
return io_data->extensions_request_context();
}
@@ -975,12 +967,10 @@
WebKit::WebNotificationPresenter::Permission
ChromeContentBrowserClient::CheckDesktopNotificationPermission(
const GURL& source_origin,
- const content::ResourceContext& context,
+ content::ResourceContext* context,
int render_process_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
-
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
if (io_data->GetExtensionInfoMap()->SecurityOriginHasAPIPermission(
source_origin, render_process_id,
ExtensionAPIPermission::kNotification))
@@ -1037,14 +1027,13 @@
bool ChromeContentBrowserClient::CanCreateWindow(
const GURL& source_origin,
WindowContainerType container_type,
- const content::ResourceContext& context,
+ content::ResourceContext* context,
int render_process_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// If the opener is trying to create a background window but doesn't have
// the appropriate permission, fail the attempt.
if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
return io_data->GetExtensionInfoMap()->SecurityOriginHasAPIPermission(
source_origin, render_process_id, ExtensionAPIPermission::kBackground);
}
@@ -1052,12 +1041,11 @@
}
std::string ChromeContentBrowserClient::GetWorkerProcessTitle(
- const GURL& url, const content::ResourceContext& context) {
+ const GURL& url, content::ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Check if it's an extension-created worker, in which case we want to use
// the name of the extension.
- ProfileIOData* io_data =
- reinterpret_cast<ProfileIOData*>(context.GetUserData(NULL));
+ ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
const Extension* extension =
io_data->GetExtensionInfoMap()->extensions().GetByID(url.host());
return extension ? extension->name() : std::string();
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/chromeos/gview_request_interceptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698