| 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 url.SchemeIs(content::kChromeUIScheme) && | 1206 url.SchemeIs(content::kChromeUIScheme) && |
| 1207 url.host_piece() != chrome::kChromeUIChromeSigninHost) { | 1207 url.host_piece() != chrome::kChromeUIChromeSigninHost) { |
| 1208 VLOG(1) << "Blocked navigation to " << url.spec() << " from " | 1208 VLOG(1) << "Blocked navigation to " << url.spec() << " from " |
| 1209 << chrome::kChromeUIChromeSigninURL; | 1209 << chrome::kChromeUIChromeSigninURL; |
| 1210 return false; | 1210 return false; |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 return true; | 1213 return true; |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 void ChromeContentBrowserClient::OverrideOpenURLParams( | 1216 void ChromeContentBrowserClient::OverrideNavigationParams( |
| 1217 content::SiteInstance* site_instance, | 1217 SiteInstance* site_instance, |
| 1218 content::OpenURLParams* params) { | 1218 ui::PageTransition* transition, |
| 1219 DCHECK(params); | 1219 bool* is_renderer_initiated, |
| 1220 content::Referrer* referrer) { |
| 1221 DCHECK(transition); |
| 1222 DCHECK(is_renderer_initiated); |
| 1223 DCHECK(referrer); |
| 1220 // TODO(crbug.com/624410): Factor the predicate to identify a URL as an NTP | 1224 // TODO(crbug.com/624410): Factor the predicate to identify a URL as an NTP |
| 1221 // to a shared library. | 1225 // to a shared library. |
| 1222 if (site_instance && | 1226 if (site_instance && |
| 1223 site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) && | 1227 site_instance->GetSiteURL().SchemeIs(chrome::kChromeSearchScheme) && |
| 1224 (site_instance->GetSiteURL().host() == | 1228 (site_instance->GetSiteURL().host() == |
| 1225 chrome::kChromeSearchRemoteNtpHost || | 1229 chrome::kChromeSearchRemoteNtpHost || |
| 1226 site_instance->GetSiteURL().host() == | 1230 site_instance->GetSiteURL().host() == |
| 1227 chrome::kChromeSearchLocalNtpHost) && | 1231 chrome::kChromeSearchLocalNtpHost) && |
| 1228 ui::PageTransitionCoreTypeIs(params->transition, | 1232 ui::PageTransitionCoreTypeIs(*transition, ui::PAGE_TRANSITION_LINK)) { |
| 1229 ui::PAGE_TRANSITION_LINK)) { | |
| 1230 // Use AUTO_BOOKMARK for clicks on tiles of the new tab page, consistently | 1233 // Use AUTO_BOOKMARK for clicks on tiles of the new tab page, consistently |
| 1231 // with native implementations like Android's. | 1234 // with native implementations like Android's. |
| 1232 params->transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK; | 1235 *transition = ui::PAGE_TRANSITION_AUTO_BOOKMARK; |
| 1233 params->is_renderer_initiated = false; | 1236 *is_renderer_initiated = false; |
| 1234 params->referrer = content::Referrer(); | 1237 *referrer = content::Referrer(); |
| 1235 } | 1238 } |
| 1239 |
| 1240 #if defined(ENABLE_EXTENSIONS) |
| 1241 ChromeContentBrowserClientExtensionsPart::OverrideNavigationParams( |
| 1242 site_instance, transition, is_renderer_initiated, referrer); |
| 1243 #endif |
| 1236 } | 1244 } |
| 1237 | 1245 |
| 1238 bool ChromeContentBrowserClient::IsSuitableHost( | 1246 bool ChromeContentBrowserClient::IsSuitableHost( |
| 1239 content::RenderProcessHost* process_host, | 1247 content::RenderProcessHost* process_host, |
| 1240 const GURL& site_url) { | 1248 const GURL& site_url) { |
| 1241 Profile* profile = | 1249 Profile* profile = |
| 1242 Profile::FromBrowserContext(process_host->GetBrowserContext()); | 1250 Profile::FromBrowserContext(process_host->GetBrowserContext()); |
| 1243 // This may be NULL during tests. In that case, just assume any site can | 1251 // This may be NULL during tests. In that case, just assume any site can |
| 1244 // share any host. | 1252 // share any host. |
| 1245 if (!profile) | 1253 if (!profile) |
| (...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3225 kWebRtcDevSwitchNames, | 3233 kWebRtcDevSwitchNames, |
| 3226 arraysize(kWebRtcDevSwitchNames)); | 3234 arraysize(kWebRtcDevSwitchNames)); |
| 3227 } | 3235 } |
| 3228 } | 3236 } |
| 3229 #endif // defined(ENABLE_WEBRTC) | 3237 #endif // defined(ENABLE_WEBRTC) |
| 3230 | 3238 |
| 3231 std::unique_ptr<content::MemoryCoordinatorDelegate> | 3239 std::unique_ptr<content::MemoryCoordinatorDelegate> |
| 3232 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { | 3240 ChromeContentBrowserClient::GetMemoryCoordinatorDelegate() { |
| 3233 return memory::ChromeMemoryCoordinatorDelegate::Create(); | 3241 return memory::ChromeMemoryCoordinatorDelegate::Create(); |
| 3234 } | 3242 } |
| OLD | NEW |