| OLD | NEW |
| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 } | 2325 } |
| 2326 | 2326 |
| 2327 if (target_url.SchemeIs(extensions::kExtensionScheme)) { | 2327 if (target_url.SchemeIs(extensions::kExtensionScheme)) { |
| 2328 // Intentionally duplicating |io_data| and |map| code from above because we | 2328 // Intentionally duplicating |io_data| and |map| code from above because we |
| 2329 // want to reduce calls to retrieve them as this function is a SYNC IPC | 2329 // want to reduce calls to retrieve them as this function is a SYNC IPC |
| 2330 // handler. | 2330 // handler. |
| 2331 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 2331 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| 2332 InfoMap* map = io_data->GetExtensionInfoMap(); | 2332 InfoMap* map = io_data->GetExtensionInfoMap(); |
| 2333 const Extension* extension = | 2333 const Extension* extension = |
| 2334 map->extensions().GetExtensionOrAppByURL(opener_url); | 2334 map->extensions().GetExtensionOrAppByURL(opener_url); |
| 2335 // TODO(lazyboy): http://crbug.com/585570, if |extension| is a platform app, |
| 2336 // disallow loading it in a tab via window.open(). Currently there are apps |
| 2337 // that rely on this to be allowed to get Cast API to work, so we are |
| 2338 // allowing this temporarily. Once Media Router is available on stable, this |
| 2339 // exception should not be required. |
| 2335 if (extension && extension->is_platform_app()) { | 2340 if (extension && extension->is_platform_app()) { |
| 2336 AppLoadedInTabSource source = | 2341 AppLoadedInTabSource source = |
| 2337 opener_top_level_frame_url == | 2342 opener_top_level_frame_url == |
| 2338 extensions::BackgroundInfo::GetBackgroundURL(extension) | 2343 extensions::BackgroundInfo::GetBackgroundURL(extension) |
| 2339 ? APP_LOADED_IN_TAB_SOURCE_BACKGROUND_PAGE | 2344 ? APP_LOADED_IN_TAB_SOURCE_BACKGROUND_PAGE |
| 2340 : APP_LOADED_IN_TAB_SOURCE_APP; | 2345 : APP_LOADED_IN_TAB_SOURCE_APP; |
| 2341 // TODO(lazyboy): Remove this UMA once the change below to disallow apps | |
| 2342 // in tabs has settled in stable branch. | |
| 2343 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLoadedInTab", source, | 2346 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLoadedInTab", source, |
| 2344 APP_LOADED_IN_TAB_SOURCE_MAX); | 2347 APP_LOADED_IN_TAB_SOURCE_MAX); |
| 2345 // Platform apps and their background pages should not be able to call | |
| 2346 // window.open() to load v2 apps in regular tab. | |
| 2347 // Simply disallow window.open() calls in this case. | |
| 2348 return false; | |
| 2349 } | 2348 } |
| 2350 } | 2349 } |
| 2351 #endif | 2350 #endif |
| 2352 | 2351 |
| 2353 HostContentSettingsMap* content_settings = | 2352 HostContentSettingsMap* content_settings = |
| 2354 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); | 2353 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); |
| 2355 | 2354 |
| 2356 #if BUILDFLAG(ENABLE_PLUGINS) | 2355 #if BUILDFLAG(ENABLE_PLUGINS) |
| 2357 if (FlashDownloadInterception::ShouldStopFlashDownloadAction( | 2356 if (FlashDownloadInterception::ShouldStopFlashDownloadAction( |
| 2358 content_settings, opener_top_level_frame_url, target_url, | 2357 content_settings, opener_top_level_frame_url, target_url, |
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3376 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { | 3375 bool ChromeContentBrowserClient::ShouldRedirectDOMStorageTaskRunner() { |
| 3377 return variations::GetVariationParamValue( | 3376 return variations::GetVariationParamValue( |
| 3378 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; | 3377 "BrowserScheduler", "RedirectDOMStorageTaskRunner") == "true"; |
| 3379 } | 3378 } |
| 3380 | 3379 |
| 3381 bool ChromeContentBrowserClient:: | 3380 bool ChromeContentBrowserClient:: |
| 3382 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3381 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
| 3383 return variations::GetVariationParamValue( | 3382 return variations::GetVariationParamValue( |
| 3384 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3383 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
| 3385 } | 3384 } |
| OLD | NEW |