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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 9609013: Use a hosted app's opener URL and not its origin to locate it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Also fix content_shell Created 8 years, 9 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) 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 DesktopNotificationService* service = 1228 DesktopNotificationService* service =
1229 DesktopNotificationServiceFactory::GetForProfile(profile); 1229 DesktopNotificationServiceFactory::GetForProfile(profile);
1230 service->CancelDesktopNotification( 1230 service->CancelDesktopNotification(
1231 render_process_id, render_view_id, notification_id); 1231 render_process_id, render_view_id, notification_id);
1232 #else 1232 #else
1233 NOTIMPLEMENTED(); 1233 NOTIMPLEMENTED();
1234 #endif 1234 #endif
1235 } 1235 }
1236 1236
1237 bool ChromeContentBrowserClient::CanCreateWindow( 1237 bool ChromeContentBrowserClient::CanCreateWindow(
1238 const GURL& opener_url,
1238 const GURL& source_origin, 1239 const GURL& source_origin,
1239 WindowContainerType container_type, 1240 WindowContainerType container_type,
1240 content::ResourceContext* context, 1241 content::ResourceContext* context,
1241 int render_process_id) { 1242 int render_process_id) {
1242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1243 // If the opener is trying to create a background window but doesn't have 1244 // If the opener is trying to create a background window but doesn't have
1244 // the appropriate permission, fail the attempt. 1245 // the appropriate permission, fail the attempt.
1245 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 1246 if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
1246 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 1247 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
1247 ExtensionInfoMap* map = io_data->GetExtensionInfoMap(); 1248 ExtensionInfoMap* map = io_data->GetExtensionInfoMap();
1248 1249
1249 // If the opener is not allowed to script its background window, then return 1250 // If the opener is not allowed to script its background window, then return
1250 // false so that the window.open call returns null. In this case, only 1251 // false so that the window.open call returns null. In this case, only
1251 // the manifest is permitted to create a background window. 1252 // the manifest is permitted to create a background window.
1252 // Note: this use of GetExtensionOrAppByURL is safe but imperfect. It may 1253 // Note: this use of GetExtensionOrAppByURL is safe but imperfect. It may
1253 // return a recently installed Extension even if this CanCreateWindow call 1254 // return a recently installed Extension even if this CanCreateWindow call
1254 // was made by an old copy of the page in a normal web process. That's ok, 1255 // was made by an old copy of the page in a normal web process. That's ok,
1255 // because the permission check below will still fail. 1256 // because the permission check below will still fail. We must use the
1257 // full URL to find hosted apps, though, and not just the origin.
1256 const Extension* extension = map->extensions().GetExtensionOrAppByURL( 1258 const Extension* extension = map->extensions().GetExtensionOrAppByURL(
1257 ExtensionURLInfo(source_origin)); 1259 ExtensionURLInfo(opener_url));
1258 if (extension && !extension->allow_background_js_access()) 1260 if (extension && !extension->allow_background_js_access())
1259 return false; 1261 return false;
1260 1262
1261 return map->SecurityOriginHasAPIPermission( 1263 return map->SecurityOriginHasAPIPermission(
1262 source_origin, render_process_id, ExtensionAPIPermission::kBackground); 1264 source_origin, render_process_id, ExtensionAPIPermission::kBackground);
1263 } 1265 }
1264 return true; 1266 return true;
1265 } 1267 }
1266 1268
1267 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( 1269 std::string ChromeContentBrowserClient::GetWorkerProcessTitle(
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 #if defined(USE_NSS) 1590 #if defined(USE_NSS)
1589 crypto::CryptoModuleBlockingPasswordDelegate* 1591 crypto::CryptoModuleBlockingPasswordDelegate*
1590 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 1592 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
1591 const GURL& url) { 1593 const GURL& url) {
1592 return browser::NewCryptoModuleBlockingDialogDelegate( 1594 return browser::NewCryptoModuleBlockingDialogDelegate(
1593 browser::kCryptoModulePasswordKeygen, url.host()); 1595 browser::kCryptoModulePasswordKeygen, url.host());
1594 } 1596 }
1595 #endif 1597 #endif
1596 1598
1597 } // namespace chrome 1599 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/mock_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698