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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 if (WebContents* new_web_contents = | 463 if (WebContents* new_web_contents = |
464 prerender_data->contents()->prerender_contents()) { | 464 prerender_data->contents()->prerender_contents()) { |
465 if (web_contents == new_web_contents) | 465 if (web_contents == new_web_contents) |
466 return false; // Do not swap in to ourself. | 466 return false; // Do not swap in to ourself. |
467 | 467 |
468 // We cannot swap in if there is no last committed entry, because we would | 468 // We cannot swap in if there is no last committed entry, because we would |
469 // show a blank page under an existing entry from the current tab. Even if | 469 // show a blank page under an existing entry from the current tab. Even if |
470 // there is a pending entry, it may not commit. | 470 // there is a pending entry, it may not commit. |
471 // TODO(creis): If there is a pending navigation and no last committed | 471 // TODO(creis): If there is a pending navigation and no last committed |
472 // entry, we might be able to transfer the network request instead. | 472 // entry, we might be able to transfer the network request instead. |
473 if (!new_web_contents->GetController().CanPruneAllButVisible()) { | 473 if (!new_web_contents->GetController().CanPruneAllButLastCommitted()) { |
474 // Abort this prerender so it is not used later. http://crbug.com/292121 | 474 // Abort this prerender so it is not used later. http://crbug.com/292121 |
475 prerender_data->contents()->Destroy(FINAL_STATUS_NAVIGATION_UNCOMMITTED); | 475 prerender_data->contents()->Destroy(FINAL_STATUS_NAVIGATION_UNCOMMITTED); |
476 return false; | 476 return false; |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 // Do not use the prerendered version if there is an opener object. | 480 // Do not use the prerendered version if there is an opener object. |
481 if (web_contents->HasOpener()) { | 481 if (web_contents->HasOpener()) { |
482 prerender_data->contents()->Destroy(FINAL_STATUS_WINDOW_OPENER); | 482 prerender_data->contents()->Destroy(FINAL_STATUS_WINDOW_OPENER); |
483 return false; | 483 return false; |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 logged_in_state_->erase(domain_key); | 1624 logged_in_state_->erase(domain_key); |
1625 } | 1625 } |
1626 | 1626 |
1627 void PrerenderManager::LoggedInPredictorDataReceived( | 1627 void PrerenderManager::LoggedInPredictorDataReceived( |
1628 scoped_ptr<LoggedInStateMap> new_map) { | 1628 scoped_ptr<LoggedInStateMap> new_map) { |
1629 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1629 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1630 logged_in_state_.swap(new_map); | 1630 logged_in_state_.swap(new_map); |
1631 } | 1631 } |
1632 | 1632 |
1633 } // namespace prerender | 1633 } // namespace prerender |
OLD | NEW |