| 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/content_settings/content_settings_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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 preview_contents_->render_view_host()->SearchBoxResize( | 975 preview_contents_->render_view_host()->SearchBoxResize( |
| 975 GetOmniboxBoundsInTermsOfPreview()); | 976 GetOmniboxBoundsInTermsOfPreview()); |
| 976 } | 977 } |
| 977 } | 978 } |
| 978 | 979 |
| 979 void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { | 980 void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { |
| 980 TabContents* new_contents = | 981 TabContents* new_contents = |
| 981 new TabContents( | 982 new TabContents( |
| 982 tab_contents->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); | 983 tab_contents->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); |
| 983 preview_contents_.reset(new TabContentsWrapper(new_contents)); | 984 preview_contents_.reset(new TabContentsWrapper(new_contents)); |
| 984 new_contents->SetAllContentsBlocked(true); | 985 preview_contents_->content_settings_tab_helper()->SetAllContentsBlocked(true); |
| 985 // Propagate the max page id. That way if we end up merging the two | 986 // Propagate the max page id. That way if we end up merging the two |
| 986 // NavigationControllers (which happens if we commit) none of the page ids | 987 // NavigationControllers (which happens if we commit) none of the page ids |
| 987 // will overlap. | 988 // will overlap. |
| 988 int32 max_page_id = tab_contents->tab_contents()->GetMaxPageID(); | 989 int32 max_page_id = tab_contents->tab_contents()->GetMaxPageID(); |
| 989 if (max_page_id != -1) | 990 if (max_page_id != -1) |
| 990 preview_contents_->controller().set_max_restored_page_id(max_page_id + 1); | 991 preview_contents_->controller().set_max_restored_page_id(max_page_id + 1); |
| 991 | 992 |
| 992 preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); | 993 preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); |
| 993 new_contents->set_delegate(preview_tab_contents_delegate_.get()); | 994 new_contents->set_delegate(preview_tab_contents_delegate_.get()); |
| 994 | 995 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1010 Source<NavigationController>(&preview_contents_->controller())); | 1011 Source<NavigationController>(&preview_contents_->controller())); |
| 1011 #endif | 1012 #endif |
| 1012 | 1013 |
| 1013 registrar_.Add( | 1014 registrar_.Add( |
| 1014 this, | 1015 this, |
| 1015 NotificationType::NAV_ENTRY_COMMITTED, | 1016 NotificationType::NAV_ENTRY_COMMITTED, |
| 1016 Source<NavigationController>(&preview_contents_->controller())); | 1017 Source<NavigationController>(&preview_contents_->controller())); |
| 1017 | 1018 |
| 1018 preview_contents_->tab_contents()->ShowContents(); | 1019 preview_contents_->tab_contents()->ShowContents(); |
| 1019 } | 1020 } |
| OLD | NEW |