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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 context)); | 934 context)); |
935 #endif | 935 #endif |
936 #if defined(OS_ANDROID) | 936 #if defined(OS_ANDROID) |
937 host->AddFilter(new EncryptedMediaMessageFilterAndroid()); | 937 host->AddFilter(new EncryptedMediaMessageFilterAndroid()); |
938 #endif | 938 #endif |
939 | 939 |
940 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( | 940 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( |
941 profile->IsOffTheRecord())); | 941 profile->IsOffTheRecord())); |
942 | 942 |
943 SendExtensionWebRequestStatusToHost(host); | 943 SendExtensionWebRequestStatusToHost(host); |
| 944 } |
| 945 |
| 946 // static |
| 947 void ChromeContentBrowserClient::SetContentSettingRules( |
| 948 content::RenderViewHost* host) { |
| 949 // <*view> guests should not be affected by ContentSettingRules. |
| 950 if (host->GetProcess()->IsGuest()) |
| 951 return; |
| 952 |
| 953 SiteInstance* site_instance = host->GetSiteInstance(); |
| 954 if (!site_instance) |
| 955 return; |
| 956 |
| 957 Profile* profile = Profile::FromBrowserContext( |
| 958 host->GetProcess()->GetBrowserContext()); |
| 959 if (!profile) |
| 960 return; |
| 961 |
| 962 ExtensionService* extension_service = |
| 963 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 964 if (!extension_service) |
| 965 return; |
| 966 |
| 967 // Extensions should not be affected by ContentSettingRules. |
| 968 const Extension* extension = extension_service->extensions()-> |
| 969 GetHostedAppByURL(site_instance->GetSiteURL()); |
| 970 if (extension) |
| 971 return; |
944 | 972 |
945 RendererContentSettingRules rules; | 973 RendererContentSettingRules rules; |
946 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); | 974 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); |
947 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); | 975 host->Send(new ChromeViewMsg_SetContentSettingRules( |
| 976 host->GetRoutingID(), rules)); |
| 977 } |
| 978 |
| 979 void ChromeContentBrowserClient::RenderViewReady( |
| 980 content::RenderViewHost* host) { |
| 981 SetContentSettingRules(host); |
948 } | 982 } |
949 | 983 |
950 GURL ChromeContentBrowserClient::GetEffectiveURL( | 984 GURL ChromeContentBrowserClient::GetEffectiveURL( |
951 content::BrowserContext* browser_context, const GURL& url) { | 985 content::BrowserContext* browser_context, const GURL& url) { |
952 Profile* profile = Profile::FromBrowserContext(browser_context); | 986 Profile* profile = Profile::FromBrowserContext(browser_context); |
953 if (!profile) | 987 if (!profile) |
954 return url; | 988 return url; |
955 | 989 |
956 // If the input |url| should be assigned to the Instant renderer, make its | 990 // If the input |url| should be assigned to the Instant renderer, make its |
957 // effective URL distinct from other URLs on the search provider's domain. | 991 // effective URL distinct from other URLs on the search provider's domain. |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2664 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2631 allowed_file_handle_origins_) || | 2665 allowed_file_handle_origins_) || |
2632 IsHostAllowedByCommandLine(url, extension_set, | 2666 IsHostAllowedByCommandLine(url, extension_set, |
2633 switches::kAllowNaClFileHandleAPI); | 2667 switches::kAllowNaClFileHandleAPI); |
2634 #else | 2668 #else |
2635 return false; | 2669 return false; |
2636 #endif | 2670 #endif |
2637 } | 2671 } |
2638 | 2672 |
2639 } // namespace chrome | 2673 } // namespace chrome |
OLD | NEW |