| 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/instant/instant_loader.h" | 5 #include "chrome/browser/instant/instant_loader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/favicon_service.h" | 17 #include "chrome/browser/favicon_service.h" |
| 18 #include "chrome/browser/history/history_marshaling.h" | 18 #include "chrome/browser/history/history_marshaling.h" |
| 19 #include "chrome/browser/instant/instant_loader_delegate.h" | 19 #include "chrome/browser/instant/instant_loader_delegate.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/search_engines/template_url.h" | 21 #include "chrome/browser/search_engines/template_url.h" |
| 22 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 23 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
| 25 #include "content/browser/renderer_host/render_view_host.h" | 26 #include "content/browser/renderer_host/render_view_host.h" |
| 26 #include "content/browser/renderer_host/render_widget_host.h" | 27 #include "content/browser/renderer_host/render_widget_host.h" |
| 27 #include "content/browser/renderer_host/render_widget_host_view.h" | 28 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 28 #include "content/browser/tab_contents/navigation_controller.h" | 29 #include "content/browser/tab_contents/navigation_controller.h" |
| 29 #include "content/browser/tab_contents/navigation_entry.h" | 30 #include "content/browser/tab_contents/navigation_entry.h" |
| 30 #include "content/browser/tab_contents/provisional_load_details.h" | 31 #include "content/browser/tab_contents/provisional_load_details.h" |
| 31 #include "content/browser/tab_contents/tab_contents.h" | 32 #include "content/browser/tab_contents/tab_contents.h" |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 preview_contents_->render_view_host()->SearchBoxResize( | 968 preview_contents_->render_view_host()->SearchBoxResize( |
| 968 GetOmniboxBoundsInTermsOfPreview()); | 969 GetOmniboxBoundsInTermsOfPreview()); |
| 969 } | 970 } |
| 970 } | 971 } |
| 971 | 972 |
| 972 void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { | 973 void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { |
| 973 TabContents* new_contents = | 974 TabContents* new_contents = |
| 974 new TabContents( | 975 new TabContents( |
| 975 tab_contents->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); | 976 tab_contents->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); |
| 976 preview_contents_.reset(new TabContentsWrapper(new_contents)); | 977 preview_contents_.reset(new TabContentsWrapper(new_contents)); |
| 977 new_contents->SetAllContentsBlocked(true); | 978 preview_contents_->blocked_content_tab_helper()->SetAllContentsBlocked(true); |
| 978 // Propagate the max page id. That way if we end up merging the two | 979 // Propagate the max page id. That way if we end up merging the two |
| 979 // NavigationControllers (which happens if we commit) none of the page ids | 980 // NavigationControllers (which happens if we commit) none of the page ids |
| 980 // will overlap. | 981 // will overlap. |
| 981 int32 max_page_id = tab_contents->tab_contents()->GetMaxPageID(); | 982 int32 max_page_id = tab_contents->tab_contents()->GetMaxPageID(); |
| 982 if (max_page_id != -1) | 983 if (max_page_id != -1) |
| 983 preview_contents_->controller().set_max_restored_page_id(max_page_id + 1); | 984 preview_contents_->controller().set_max_restored_page_id(max_page_id + 1); |
| 984 | 985 |
| 985 preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); | 986 preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); |
| 986 new_contents->set_delegate(preview_tab_contents_delegate_.get()); | 987 new_contents->set_delegate(preview_tab_contents_delegate_.get()); |
| 987 | 988 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1003 Source<NavigationController>(&preview_contents_->controller())); | 1004 Source<NavigationController>(&preview_contents_->controller())); |
| 1004 #endif | 1005 #endif |
| 1005 | 1006 |
| 1006 registrar_.Add( | 1007 registrar_.Add( |
| 1007 this, | 1008 this, |
| 1008 NotificationType::NAV_ENTRY_COMMITTED, | 1009 NotificationType::NAV_ENTRY_COMMITTED, |
| 1009 Source<NavigationController>(&preview_contents_->controller())); | 1010 Source<NavigationController>(&preview_contents_->controller())); |
| 1010 | 1011 |
| 1011 preview_contents_->tab_contents()->ShowContents(); | 1012 preview_contents_->tab_contents()->ShowContents(); |
| 1012 } | 1013 } |
| OLD | NEW |