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/prerender/prerender_manager.h" | 5 #include "chrome/browser/prerender/prerender_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 if (!source_web_contents) | 264 if (!source_web_contents) |
265 return NULL; | 265 return NULL; |
266 if (source_web_contents->GetURL().host() == url.host()) | 266 if (source_web_contents->GetURL().host() == url.host()) |
267 origin = ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN; | 267 origin = ORIGIN_LINK_REL_PRERENDER_SAMEDOMAIN; |
268 // TODO(ajwong): This does not correctly handle storage for isolated apps. | 268 // TODO(ajwong): This does not correctly handle storage for isolated apps. |
269 session_storage_namespace = | 269 session_storage_namespace = |
270 source_web_contents->GetController() | 270 source_web_contents->GetController() |
271 .GetDefaultSessionStorageNamespace(); | 271 .GetDefaultSessionStorageNamespace(); |
272 } | 272 } |
273 | 273 |
274 // If the prerender request comes from a recently cancelled prerender that | |
275 // |this| still owns, then abort the prerender. | |
276 for (ScopedVector<PrerenderData>::iterator it = to_delete_prerenders_.begin(); | |
277 it != to_delete_prerenders_.end(); ++it) { | |
278 PrerenderContents* prerender_contents = (*it)->contents(); | |
279 int contents_child_id; | |
280 int contents_route_id; | |
281 if (prerender_contents->GetChildId(&contents_child_id) && | |
282 prerender_contents->GetRouteId(&contents_route_id) && | |
283 contents_child_id == process_id && contents_route_id == route_id) { | |
gavinp
2013/02/27 19:29:47
This expression freaks me out a bit. I had to stop
| |
284 return NULL; | |
285 } | |
286 } | |
287 | |
274 if (PrerenderData* parent_prerender_data = | 288 if (PrerenderData* parent_prerender_data = |
275 FindPrerenderDataForChildAndRoute(process_id, route_id)) { | 289 FindPrerenderDataForChildAndRoute(process_id, route_id)) { |
276 // Instead of prerendering from inside of a running prerender, we will defer | 290 // Instead of prerendering from inside of a running prerender, we will defer |
277 // this request until its launcher is made visible. | 291 // this request until its launcher is made visible. |
278 if (PrerenderContents* contents = parent_prerender_data->contents()) { | 292 if (PrerenderContents* contents = parent_prerender_data->contents()) { |
279 PrerenderHandle* prerender_handle = | 293 PrerenderHandle* prerender_handle = |
280 new PrerenderHandle(static_cast<PrerenderData*>(NULL)); | 294 new PrerenderHandle(static_cast<PrerenderData*>(NULL)); |
281 scoped_ptr<PrerenderContents::PendingPrerenderInfo> | 295 scoped_ptr<PrerenderContents::PendingPrerenderInfo> |
282 pending_prerender_info(new PrerenderContents::PendingPrerenderInfo( | 296 pending_prerender_info(new PrerenderContents::PendingPrerenderInfo( |
283 prerender_handle->weak_ptr_factory_.GetWeakPtr(), | 297 prerender_handle->weak_ptr_factory_.GetWeakPtr(), |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1310 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1324 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1311 return NULL; | 1325 return NULL; |
1312 Profile* profile = Profile::FromBrowserContext( | 1326 Profile* profile = Profile::FromBrowserContext( |
1313 render_process_host->GetBrowserContext()); | 1327 render_process_host->GetBrowserContext()); |
1314 if (!profile) | 1328 if (!profile) |
1315 return NULL; | 1329 return NULL; |
1316 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1330 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1317 } | 1331 } |
1318 | 1332 |
1319 } // namespace prerender | 1333 } // namespace prerender |
OLD | NEW |