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 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 #include "components/nacl/browser/nacl_process_host.h" | 215 #include "components/nacl/browser/nacl_process_host.h" |
216 #include "components/nacl/common/nacl_process_type.h" | 216 #include "components/nacl/common/nacl_process_type.h" |
217 #include "components/nacl/common/nacl_switches.h" | 217 #include "components/nacl/common/nacl_switches.h" |
218 #endif | 218 #endif |
219 | 219 |
220 #if defined(ENABLE_EXTENSIONS) | 220 #if defined(ENABLE_EXTENSIONS) |
221 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" | 221 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par
t.h" |
222 #include "chrome/browser/extensions/extension_service.h" | 222 #include "chrome/browser/extensions/extension_service.h" |
223 #include "chrome/browser/extensions/extension_util.h" | 223 #include "chrome/browser/extensions/extension_util.h" |
224 #include "chrome/browser/extensions/suggest_permission_util.h" | 224 #include "chrome/browser/extensions/suggest_permission_util.h" |
225 #include "chrome/browser/guest_view/guest_view_base.h" | |
226 #include "chrome/browser/guest_view/guest_view_manager.h" | |
227 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | 225 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
228 #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" | 226 #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" |
229 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" | 227 #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" |
| 228 #include "extensions/browser/guest_view/guest_view_base.h" |
230 #include "extensions/browser/guest_view/guest_view_constants.h" | 229 #include "extensions/browser/guest_view/guest_view_constants.h" |
| 230 #include "extensions/browser/guest_view/guest_view_manager.h" |
231 #include "extensions/common/manifest_handlers/background_info.h" | 231 #include "extensions/common/manifest_handlers/background_info.h" |
232 #endif | 232 #endif |
233 | 233 |
234 #if defined(ENABLE_SPELLCHECK) | 234 #if defined(ENABLE_SPELLCHECK) |
235 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 235 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
236 #endif | 236 #endif |
237 | 237 |
238 #if defined(ENABLE_SERVICE_DISCOVERY) | 238 #if defined(ENABLE_SERVICE_DISCOVERY) |
239 #include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h" | 239 #include "chrome/browser/local_discovery/storage/privet_filesystem_backend.h" |
240 #endif | 240 #endif |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 std::string* partition_name, | 734 std::string* partition_name, |
735 bool* in_memory) { | 735 bool* in_memory) { |
736 // Default to the browser-wide storage partition and override based on |site| | 736 // Default to the browser-wide storage partition and override based on |site| |
737 // below. | 737 // below. |
738 partition_domain->clear(); | 738 partition_domain->clear(); |
739 partition_name->clear(); | 739 partition_name->clear(); |
740 *in_memory = false; | 740 *in_memory = false; |
741 | 741 |
742 bool success = false; | 742 bool success = false; |
743 #if defined(ENABLE_EXTENSIONS) | 743 #if defined(ENABLE_EXTENSIONS) |
744 success = WebViewGuest::GetGuestPartitionConfigForSite( | 744 success = extensions::WebViewGuest::GetGuestPartitionConfigForSite( |
745 site, partition_domain, partition_name, in_memory); | 745 site, partition_domain, partition_name, in_memory); |
746 | 746 |
747 if (!success && site.SchemeIs(extensions::kExtensionScheme)) { | 747 if (!success && site.SchemeIs(extensions::kExtensionScheme)) { |
748 // If |can_be_default| is false, the caller is stating that the |site| | 748 // If |can_be_default| is false, the caller is stating that the |site| |
749 // should be parsed as if it had isolated storage. In particular it is | 749 // should be parsed as if it had isolated storage. In particular it is |
750 // important to NOT check ExtensionService for the is_storage_isolated() | 750 // important to NOT check ExtensionService for the is_storage_isolated() |
751 // attribute because this code path is run during Extension uninstall | 751 // attribute because this code path is run during Extension uninstall |
752 // to do cleanup after the Extension has already been unloaded from the | 752 // to do cleanup after the Extension has already been unloaded from the |
753 // ExtensionService. | 753 // ExtensionService. |
754 bool is_isolated = !can_be_default; | 754 bool is_isolated = !can_be_default; |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 std::map<int, int> process_map; | 1578 std::map<int, int> process_map; |
1579 std::map<int, int>::const_iterator it; | 1579 std::map<int, int>::const_iterator it; |
1580 bool has_web_view_guest = false; | 1580 bool has_web_view_guest = false; |
1581 // Record access to file system for potential display in UI. | 1581 // Record access to file system for potential display in UI. |
1582 for (i = render_frames.begin(); i != render_frames.end(); ++i) { | 1582 for (i = render_frames.begin(); i != render_frames.end(); ++i) { |
1583 if (process_map.find(i->first) != process_map.end()) | 1583 if (process_map.find(i->first) != process_map.end()) |
1584 continue; | 1584 continue; |
1585 | 1585 |
1586 process_map.insert(std::pair<int, int>(i->first, i->second)); | 1586 process_map.insert(std::pair<int, int>(i->first, i->second)); |
1587 | 1587 |
1588 if (WebViewRendererState::GetInstance()->IsGuest(i->first)) | 1588 if (extensions::WebViewRendererState::GetInstance()->IsGuest(i->first)) |
1589 has_web_view_guest = true; | 1589 has_web_view_guest = true; |
1590 } | 1590 } |
1591 if (!has_web_view_guest) { | 1591 if (!has_web_view_guest) { |
1592 FileSystemAccessed(url, render_frames, callback, allow); | 1592 FileSystemAccessed(url, render_frames, callback, allow); |
1593 return; | 1593 return; |
1594 } | 1594 } |
1595 DCHECK_EQ(1U, process_map.size()); | 1595 DCHECK_EQ(1U, process_map.size()); |
1596 it = process_map.begin(); | 1596 it = process_map.begin(); |
1597 BrowserThread::PostTask( | 1597 BrowserThread::PostTask( |
1598 BrowserThread::UI, | 1598 BrowserThread::UI, |
(...skipping 11 matching lines...) Expand all Loading... |
1610 callback))); | 1610 callback))); |
1611 } | 1611 } |
1612 | 1612 |
1613 void ChromeContentBrowserClient::RequestFileSystemPermissionOnUIThread( | 1613 void ChromeContentBrowserClient::RequestFileSystemPermissionOnUIThread( |
1614 int render_process_id, | 1614 int render_process_id, |
1615 int render_frame_id, | 1615 int render_frame_id, |
1616 const GURL& url, | 1616 const GURL& url, |
1617 bool allowed_by_default, | 1617 bool allowed_by_default, |
1618 const base::Callback<void(bool)>& callback) { | 1618 const base::Callback<void(bool)>& callback) { |
1619 DCHECK(BrowserThread:: CurrentlyOn(BrowserThread::UI)); | 1619 DCHECK(BrowserThread:: CurrentlyOn(BrowserThread::UI)); |
1620 WebViewPermissionHelper* web_view_permission_helper = | 1620 extensions::WebViewPermissionHelper* web_view_permission_helper = |
1621 WebViewPermissionHelper::FromFrameID(render_process_id, | 1621 extensions::WebViewPermissionHelper::FromFrameID( |
1622 render_frame_id); | 1622 render_process_id, render_frame_id); |
1623 web_view_permission_helper->RequestFileSystemPermission(url, | 1623 web_view_permission_helper->RequestFileSystemPermission(url, |
1624 allowed_by_default, | 1624 allowed_by_default, |
1625 callback); | 1625 callback); |
1626 } | 1626 } |
1627 #endif | 1627 #endif |
1628 | 1628 |
1629 void ChromeContentBrowserClient::FileSystemAccessed( | 1629 void ChromeContentBrowserClient::FileSystemAccessed( |
1630 const GURL& url, | 1630 const GURL& url, |
1631 const std::vector<std::pair<int, int> >& render_frames, | 1631 const std::vector<std::pair<int, int> >& render_frames, |
1632 base::Callback<void(bool)> callback, | 1632 base::Callback<void(bool)> callback, |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 const Extension* extension = | 2037 const Extension* extension = |
2038 map->extensions().GetExtensionOrAppByURL(opener_url); | 2038 map->extensions().GetExtensionOrAppByURL(opener_url); |
2039 if (extension && !extensions::BackgroundInfo::AllowJSAccess(extension)) | 2039 if (extension && !extensions::BackgroundInfo::AllowJSAccess(extension)) |
2040 *no_javascript_access = true; | 2040 *no_javascript_access = true; |
2041 #endif | 2041 #endif |
2042 | 2042 |
2043 return true; | 2043 return true; |
2044 } | 2044 } |
2045 | 2045 |
2046 #if defined(ENABLE_EXTENSIONS) | 2046 #if defined(ENABLE_EXTENSIONS) |
2047 if (WebViewRendererState::GetInstance()->IsGuest(render_process_id)) | 2047 if (extensions::WebViewRendererState::GetInstance()->IsGuest( |
| 2048 render_process_id)) |
2048 return true; | 2049 return true; |
2049 #endif | 2050 #endif |
2050 | 2051 |
2051 HostContentSettingsMap* content_settings = | 2052 HostContentSettingsMap* content_settings = |
2052 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); | 2053 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); |
2053 BlockedWindowParams blocked_params(target_url, | 2054 BlockedWindowParams blocked_params(target_url, |
2054 referrer, | 2055 referrer, |
2055 disposition, | 2056 disposition, |
2056 features, | 2057 features, |
2057 user_gesture, | 2058 user_gesture, |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 switches::kDisableWebRtcEncryption, | 2641 switches::kDisableWebRtcEncryption, |
2641 }; | 2642 }; |
2642 to_command_line->CopySwitchesFrom(from_command_line, | 2643 to_command_line->CopySwitchesFrom(from_command_line, |
2643 kWebRtcDevSwitchNames, | 2644 kWebRtcDevSwitchNames, |
2644 arraysize(kWebRtcDevSwitchNames)); | 2645 arraysize(kWebRtcDevSwitchNames)); |
2645 } | 2646 } |
2646 } | 2647 } |
2647 #endif // defined(ENABLE_WEBRTC) | 2648 #endif // defined(ENABLE_WEBRTC) |
2648 | 2649 |
2649 } // namespace chrome | 2650 } // namespace chrome |
OLD | NEW |