| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 23 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
| 24 #include "chrome/common/icon_messages.h" | 24 #include "chrome/common/icon_messages.h" |
| 25 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "content/browser/renderer_host/render_view_host.h" | 27 #include "content/browser/renderer_host/render_view_host.h" |
| 28 #include "content/browser/renderer_host/resource_request_details.h" | 28 #include "content/browser/renderer_host/resource_request_details.h" |
| 29 #include "content/browser/tab_contents/tab_contents_delegate.h" | 29 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 30 #include "content/browser/tab_contents/tab_contents_view.h" | 30 #include "content/browser/tab_contents/tab_contents_view.h" |
| 31 #include "content/common/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 32 #include "content/common/view_messages.h" | 32 #include "content/common/view_messages.h" |
| 33 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
| 34 | 34 |
| 35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
| 36 #include "content/browser/mach_broker_mac.h" | 36 #include "content/browser/mach_broker_mac.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace prerender { | 39 namespace prerender { |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // RenderViewHost. This must be done before the Navigate message to catch all | 285 // RenderViewHost. This must be done before the Navigate message to catch all |
| 286 // resource requests, but as it is on the same thread as the Navigate message | 286 // resource requests, but as it is on the same thread as the Navigate message |
| 287 // (IO) there is no race condition. | 287 // (IO) there is no race condition. |
| 288 prerender_tracker_->OnPrerenderingStarted( | 288 prerender_tracker_->OnPrerenderingStarted( |
| 289 child_id_, | 289 child_id_, |
| 290 route_id_, | 290 route_id_, |
| 291 prerender_manager_); | 291 prerender_manager_); |
| 292 | 292 |
| 293 // Close ourselves when the application is shutting down. | 293 // Close ourselves when the application is shutting down. |
| 294 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, | 294 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, |
| 295 NotificationService::AllSources()); | 295 content::NotificationService::AllSources()); |
| 296 | 296 |
| 297 // Register for our parent profile to shutdown, so we can shut ourselves down | 297 // Register for our parent profile to shutdown, so we can shut ourselves down |
| 298 // as well (should only be called for OTR profiles, as we should receive | 298 // as well (should only be called for OTR profiles, as we should receive |
| 299 // APP_TERMINATING before non-OTR profiles are destroyed). | 299 // APP_TERMINATING before non-OTR profiles are destroyed). |
| 300 // TODO(tburkard): figure out if this is needed. | 300 // TODO(tburkard): figure out if this is needed. |
| 301 notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 301 notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 302 content::Source<Profile>(profile_)); | 302 content::Source<Profile>(profile_)); |
| 303 | 303 |
| 304 // Register to inform new RenderViews that we're prerendering. | 304 // Register to inform new RenderViews that we're prerendering. |
| 305 notification_registrar_.Add( | 305 notification_registrar_.Add( |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 658 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
| 659 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) | 659 if (!prerender_contents_.get() || !prerender_contents_->tab_contents()) |
| 660 return false; | 660 return false; |
| 661 const TabContents* tab_contents = prerender_contents_->tab_contents(); | 661 const TabContents* tab_contents = prerender_contents_->tab_contents(); |
| 662 return (tab_contents->GetSiteInstance() != | 662 return (tab_contents->GetSiteInstance() != |
| 663 tab_contents->GetPendingSiteInstance()); | 663 tab_contents->GetPendingSiteInstance()); |
| 664 } | 664 } |
| 665 | 665 |
| 666 | 666 |
| 667 } // namespace prerender | 667 } // namespace prerender |
| OLD | NEW |