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 <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_tokenizer.h" | 15 #include "base/strings/string_tokenizer.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/app/breakpad_mac.h" | 17 #include "chrome/app/breakpad_mac.h" |
| 18 #include "chrome/browser/app_mode/app_mode_utils.h" |
18 #include "chrome/browser/browser_about_handler.h" | 19 #include "chrome/browser/browser_about_handler.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
21 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 22 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
22 #include "chrome/browser/character_encoding.h" | 23 #include "chrome/browser/character_encoding.h" |
23 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" | 24 #include "chrome/browser/chrome_net_benchmarking_message_filter.h" |
24 #include "chrome/browser/chrome_quota_permission_context.h" | 25 #include "chrome/browser/chrome_quota_permission_context.h" |
25 #include "chrome/browser/content_settings/content_settings_utils.h" | 26 #include "chrome/browser/content_settings/content_settings_utils.h" |
26 #include "chrome/browser/content_settings/cookie_settings.h" | 27 #include "chrome/browser/content_settings/cookie_settings.h" |
27 #include "chrome/browser/content_settings/host_content_settings_map.h" | 28 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( | 532 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( |
532 content::BrowserContext* browser_context, | 533 content::BrowserContext* browser_context, |
533 const GURL& site) { | 534 const GURL& site) { |
534 std::string partition_id; | 535 std::string partition_id; |
535 | 536 |
536 // The partition ID for webview guest processes is the string value of its | 537 // The partition ID for webview guest processes is the string value of its |
537 // SiteInstance URL - "chrome-guest://app_id/persist?partition". | 538 // SiteInstance URL - "chrome-guest://app_id/persist?partition". |
538 if (site.SchemeIs(chrome::kGuestScheme)) | 539 if (site.SchemeIs(chrome::kGuestScheme)) |
539 partition_id = site.spec(); | 540 partition_id = site.spec(); |
540 | 541 |
541 DCHECK(IsValidStoragePartitionId(browser_context,partition_id)); | 542 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
542 return partition_id; | 543 return partition_id; |
543 } | 544 } |
544 | 545 |
545 bool ChromeContentBrowserClient::IsValidStoragePartitionId( | 546 bool ChromeContentBrowserClient::IsValidStoragePartitionId( |
546 content::BrowserContext* browser_context, | 547 content::BrowserContext* browser_context, |
547 const std::string& partition_id) { | 548 const std::string& partition_id) { |
548 // The default ID is empty and is always valid. | 549 // The default ID is empty and is always valid. |
549 if (partition_id.empty()) | 550 if (partition_id.empty()) |
550 return true; | 551 return true; |
551 | 552 |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 // return a recently installed Extension even if this CanCreateWindow call | 1687 // return a recently installed Extension even if this CanCreateWindow call |
1687 // was made by an old copy of the page in a normal web process. That's ok, | 1688 // was made by an old copy of the page in a normal web process. That's ok, |
1688 // because the permission check above would have caused an early return | 1689 // because the permission check above would have caused an early return |
1689 // already. We must use the full URL to find hosted apps, though, and not | 1690 // already. We must use the full URL to find hosted apps, though, and not |
1690 // just the origin. | 1691 // just the origin. |
1691 const Extension* extension = map->extensions().GetExtensionOrAppByURL( | 1692 const Extension* extension = map->extensions().GetExtensionOrAppByURL( |
1692 ExtensionURLInfo(opener_url)); | 1693 ExtensionURLInfo(opener_url)); |
1693 if (extension && !extensions::BackgroundInfo::AllowJSAccess(extension)) | 1694 if (extension && !extensions::BackgroundInfo::AllowJSAccess(extension)) |
1694 *no_javascript_access = true; | 1695 *no_javascript_access = true; |
1695 } | 1696 } |
| 1697 |
| 1698 // No new browser window (popup or tab) in app mode. |
| 1699 if (container_type == WINDOW_CONTAINER_TYPE_NORMAL && |
| 1700 chrome::IsRunningInForcedAppMode()) { |
| 1701 return false; |
| 1702 } |
| 1703 |
1696 return true; | 1704 return true; |
1697 } | 1705 } |
1698 | 1706 |
1699 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( | 1707 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( |
1700 const GURL& url, content::ResourceContext* context) { | 1708 const GURL& url, content::ResourceContext* context) { |
1701 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1709 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1702 // Check if it's an extension-created worker, in which case we want to use | 1710 // Check if it's an extension-created worker, in which case we want to use |
1703 // the name of the extension. | 1711 // the name of the extension. |
1704 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1712 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1705 const Extension* extension = | 1713 const Extension* extension = |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 io_thread_application_locale_ = locale; | 2191 io_thread_application_locale_ = locale; |
2184 } | 2192 } |
2185 | 2193 |
2186 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( | 2194 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( |
2187 const std::string& locale) { | 2195 const std::string& locale) { |
2188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2189 io_thread_application_locale_ = locale; | 2197 io_thread_application_locale_ = locale; |
2190 } | 2198 } |
2191 | 2199 |
2192 } // namespace chrome | 2200 } // namespace chrome |
OLD | NEW |