Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: chrome/browser/instant/instant_loader.cc

Issue 10539064: TabContentsWrapper -> TabContents, part 18. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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>
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/history/history_tab_helper.h" 21 #include "chrome/browser/history/history_tab_helper.h"
22 #include "chrome/browser/instant/instant_loader_delegate.h" 22 #include "chrome/browser/instant/instant_loader_delegate.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/search_engines/template_url.h" 24 #include "chrome/browser/search_engines/template_url.h"
25 #include "chrome/browser/tab_contents/thumbnail_generator.h" 25 #include "chrome/browser/tab_contents/thumbnail_generator.h"
26 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 26 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
27 #include "chrome/browser/ui/constrained_window_tab_helper.h" 27 #include "chrome/browser/ui/constrained_window_tab_helper.h"
28 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" 28 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
29 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 29 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
30 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 30 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 31 #include "chrome/browser/ui/tab_contents/tab_contents.h"
32 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/render_messages.h" 34 #include "chrome/common/render_messages.h"
35 #include "content/public/browser/favicon_status.h" 35 #include "content/public/browser/favicon_status.h"
36 #include "content/public/browser/navigation_controller.h" 36 #include "content/public/browser/navigation_controller.h"
37 #include "content/public/browser/navigation_details.h" 37 #include "content/public/browser/navigation_details.h"
38 #include "content/public/browser/navigation_entry.h" 38 #include "content/public/browser/navigation_entry.h"
39 #include "content/public/browser/notification_details.h" 39 #include "content/public/browser/notification_details.h"
40 #include "content/public/browser/notification_observer.h" 40 #include "content/public/browser/notification_observer.h"
41 #include "content/public/browser/notification_registrar.h" 41 #include "content/public/browser/notification_registrar.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DCHECK(0 <= usage && usage < PREVIEW_NUM_TYPES); 85 DCHECK(0 <= usage && usage < PREVIEW_NUM_TYPES);
86 // Only track the histogram for the instant loaders, for now. 86 // Only track the histogram for the instant loaders, for now.
87 if (template_url_id) { 87 if (template_url_id) {
88 base::Histogram* histogram = base::LinearHistogram::FactoryGet( 88 base::Histogram* histogram = base::LinearHistogram::FactoryGet(
89 "Instant.Previews" + group, 1, PREVIEW_NUM_TYPES, PREVIEW_NUM_TYPES + 1, 89 "Instant.Previews" + group, 1, PREVIEW_NUM_TYPES, PREVIEW_NUM_TYPES + 1,
90 base::Histogram::kUmaTargetedHistogramFlag); 90 base::Histogram::kUmaTargetedHistogramFlag);
91 histogram->Add(usage); 91 histogram->Add(usage);
92 } 92 }
93 } 93 }
94 94
95 SessionStorageNamespace* GetSessionStorageNamespace(TabContentsWrapper* tab) { 95 SessionStorageNamespace* GetSessionStorageNamespace(TabContents* tab) {
96 return tab->web_contents()->GetController().GetSessionStorageNamespace(); 96 return tab->web_contents()->GetController().GetSessionStorageNamespace();
97 } 97 }
98 98
99 } // namespace 99 } // namespace
100 100
101 // static 101 // static
102 const char* const InstantLoader::kInstantHeader = "X-Purpose"; 102 const char* const InstantLoader::kInstantHeader = "X-Purpose";
103 // static 103 // static
104 const char* const InstantLoader::kInstantHeaderValue = "instant"; 104 const char* const InstantLoader::kInstantHeaderValue = "instant";
105 105
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 int request_id, 240 int request_id,
241 const std::string& request_method) OVERRIDE; 241 const std::string& request_method) OVERRIDE;
242 virtual void HandleMouseUp() OVERRIDE; 242 virtual void HandleMouseUp() OVERRIDE;
243 virtual void HandleMouseActivate() OVERRIDE; 243 virtual void HandleMouseActivate() OVERRIDE;
244 virtual bool OnGoToEntryOffset(int offset) OVERRIDE; 244 virtual bool OnGoToEntryOffset(int offset) OVERRIDE;
245 virtual bool ShouldAddNavigationToHistory( 245 virtual bool ShouldAddNavigationToHistory(
246 const history::HistoryAddPageArgs& add_page_args, 246 const history::HistoryAddPageArgs& add_page_args,
247 content::NavigationType navigation_type) OVERRIDE; 247 content::NavigationType navigation_type) OVERRIDE;
248 248
249 // CoreTabHelperDelegate: 249 // CoreTabHelperDelegate:
250 virtual void SwapTabContents(TabContentsWrapper* old_tc, 250 virtual void SwapTabContents(TabContents* old_tc,
251 TabContentsWrapper* new_tc) OVERRIDE; 251 TabContents* new_tc) OVERRIDE;
252 252
253 // ConstrainedWindowTabHelperDelegate: 253 // ConstrainedWindowTabHelperDelegate:
254 virtual void WillShowConstrainedWindow(TabContentsWrapper* source) OVERRIDE; 254 virtual void WillShowConstrainedWindow(TabContents* source) OVERRIDE;
255 virtual bool ShouldFocusConstrainedWindow() OVERRIDE; 255 virtual bool ShouldFocusConstrainedWindow() OVERRIDE;
256 256
257 // content::WebContentsObserver: 257 // content::WebContentsObserver:
258 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 258 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
259 virtual void DidFailProvisionalLoad( 259 virtual void DidFailProvisionalLoad(
260 int64 frame_id, 260 int64 frame_id,
261 bool is_main_frame, 261 bool is_main_frame,
262 const GURL& validated_url, 262 const GURL& validated_url,
263 int error_code, 263 int error_code,
264 const string16& error_description, 264 const string16& error_description,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 args->redirects.clear(); 341 args->redirects.clear();
342 args->redirects.push_back(url); 342 args->redirects.push_back(url);
343 343
344 // Prune all but the first entry. 344 // Prune all but the first entry.
345 add_page_vector_.erase(add_page_vector_.begin() + 1, 345 add_page_vector_.erase(add_page_vector_.begin() + 1,
346 add_page_vector_.end()); 346 add_page_vector_.end());
347 } 347 }
348 348
349 void InstantLoader::TabContentsDelegateImpl::CommitHistory( 349 void InstantLoader::TabContentsDelegateImpl::CommitHistory(
350 bool supports_instant) { 350 bool supports_instant) {
351 TabContentsWrapper* tab = loader_->preview_contents(); 351 TabContents* tab = loader_->preview_contents();
352 if (tab->profile()->IsOffTheRecord()) 352 if (tab->profile()->IsOffTheRecord())
353 return; 353 return;
354 354
355 for (size_t i = 0; i < add_page_vector_.size(); ++i) { 355 for (size_t i = 0; i < add_page_vector_.size(); ++i) {
356 tab->history_tab_helper()->UpdateHistoryForNavigation( 356 tab->history_tab_helper()->UpdateHistoryForNavigation(
357 add_page_vector_[i].get()); 357 add_page_vector_[i].get());
358 } 358 }
359 359
360 NavigationEntry* active_entry = 360 NavigationEntry* active_entry =
361 tab->web_contents()->GetController().GetActiveEntry(); 361 tab->web_contents()->GetController().GetActiveEntry();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 if (!waiting_for_new_page_) { 526 if (!waiting_for_new_page_) {
527 add_page_vector_.push_back( 527 add_page_vector_.push_back(
528 scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone())); 528 scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone()));
529 } 529 }
530 return false; 530 return false;
531 } 531 }
532 532
533 // If this is being called, something is swapping in to our preview_contents_ 533 // If this is being called, something is swapping in to our preview_contents_
534 // before we've added it to the tab strip. 534 // before we've added it to the tab strip.
535 void InstantLoader::TabContentsDelegateImpl::SwapTabContents( 535 void InstantLoader::TabContentsDelegateImpl::SwapTabContents(
536 TabContentsWrapper* old_tc, 536 TabContents* old_tc,
537 TabContentsWrapper* new_tc) { 537 TabContents* new_tc) {
538 loader_->ReplacePreviewContents(old_tc, new_tc); 538 loader_->ReplacePreviewContents(old_tc, new_tc);
539 } 539 }
540 540
541 bool InstantLoader::TabContentsDelegateImpl::ShouldFocusConstrainedWindow() { 541 bool InstantLoader::TabContentsDelegateImpl::ShouldFocusConstrainedWindow() {
542 // Return false so that constrained windows are not initially focused. If 542 // Return false so that constrained windows are not initially focused. If
543 // we did otherwise the preview would prematurely get committed when focus 543 // we did otherwise the preview would prematurely get committed when focus
544 // goes to the constrained window. 544 // goes to the constrained window.
545 return false; 545 return false;
546 } 546 }
547 547
548 void InstantLoader::TabContentsDelegateImpl::WillShowConstrainedWindow( 548 void InstantLoader::TabContentsDelegateImpl::WillShowConstrainedWindow(
549 TabContentsWrapper* source) { 549 TabContents* source) {
550 if (!loader_->ready()) { 550 if (!loader_->ready()) {
551 // A constrained window shown for an auth may not paint. Show the preview 551 // A constrained window shown for an auth may not paint. Show the preview
552 // contents. 552 // contents.
553 UnregisterForPaintNotifications(); 553 UnregisterForPaintNotifications();
554 loader_->ShowPreview(); 554 loader_->ShowPreview();
555 } 555 }
556 } 556 }
557 557
558 bool InstantLoader::TabContentsDelegateImpl::OnMessageReceived( 558 bool InstantLoader::TabContentsDelegateImpl::OnMessageReceived(
559 const IPC::Message& message) { 559 const IPC::Message& message) {
(...skipping 19 matching lines...) Expand all
579 // instant active). To ensure the download happens when the user presses 579 // instant active). To ensure the download happens when the user presses
580 // enter we set needs_reload_ to true, which triggers a reload. 580 // enter we set needs_reload_ to true, which triggers a reload.
581 loader_->needs_reload_ = true; 581 loader_->needs_reload_ = true;
582 } 582 }
583 } 583 }
584 584
585 void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions( 585 void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions(
586 int32 page_id, 586 int32 page_id,
587 const std::vector<std::string>& suggestions, 587 const std::vector<std::string>& suggestions,
588 InstantCompleteBehavior behavior) { 588 InstantCompleteBehavior behavior) {
589 TabContentsWrapper* source = loader_->preview_contents(); 589 TabContents* source = loader_->preview_contents();
590 NavigationEntry* entry = 590 NavigationEntry* entry =
591 source->web_contents()->GetController().GetActiveEntry(); 591 source->web_contents()->GetController().GetActiveEntry();
592 if (!entry || page_id != entry->GetPageID()) 592 if (!entry || page_id != entry->GetPageID())
593 return; 593 return;
594 594
595 if (suggestions.empty()) 595 if (suggestions.empty())
596 loader_->SetCompleteSuggestedText(string16(), behavior); 596 loader_->SetCompleteSuggestedText(string16(), behavior);
597 else 597 else
598 loader_->SetCompleteSuggestedText(UTF8ToUTF16(suggestions[0]), behavior); 598 loader_->SetCompleteSuggestedText(UTF8ToUTF16(suggestions[0]), behavior);
599 } 599 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 http_status_ok_(true), 637 http_status_ok_(true),
638 last_transition_type_(content::PAGE_TRANSITION_LINK), 638 last_transition_type_(content::PAGE_TRANSITION_LINK),
639 verbatim_(false), 639 verbatim_(false),
640 needs_reload_(false), 640 needs_reload_(false),
641 group_(group) { 641 group_(group) {
642 } 642 }
643 643
644 InstantLoader::~InstantLoader() { 644 InstantLoader::~InstantLoader() {
645 registrar_.RemoveAll(); 645 registrar_.RemoveAll();
646 646
647 // Delete the TabContentsWrapper before the delegate as the TabContentsWrapper 647 // Delete the TabContents before the delegate as the TabContents
648 // holds a reference to the delegate. 648 // holds a reference to the delegate.
649 if (preview_contents()) 649 if (preview_contents())
650 AddPreviewUsageForHistogram(template_url_id_, PREVIEW_DELETED, group_); 650 AddPreviewUsageForHistogram(template_url_id_, PREVIEW_DELETED, group_);
651 preview_contents_.reset(); 651 preview_contents_.reset();
652 } 652 }
653 653
654 bool InstantLoader::Update(TabContentsWrapper* tab_contents, 654 bool InstantLoader::Update(TabContents* tab_contents,
655 const TemplateURL* template_url, 655 const TemplateURL* template_url,
656 const GURL& url, 656 const GURL& url,
657 content::PageTransition transition_type, 657 content::PageTransition transition_type,
658 const string16& user_text, 658 const string16& user_text,
659 bool verbatim, 659 bool verbatim,
660 string16* suggested_text) { 660 string16* suggested_text) {
661 DCHECK(!url.is_empty() && url.is_valid()); 661 DCHECK(!url.is_empty() && url.is_valid());
662 662
663 // Strip leading ?. 663 // Strip leading ?.
664 string16 new_user_text = 664 string16 new_user_text =
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 this, &InstantLoader::ProcessBoundsChange); 765 this, &InstantLoader::ProcessBoundsChange);
766 } 766 }
767 } 767 }
768 } 768 }
769 769
770 bool InstantLoader::IsMouseDownFromActivate() { 770 bool InstantLoader::IsMouseDownFromActivate() {
771 return preview_tab_contents_delegate_.get() && 771 return preview_tab_contents_delegate_.get() &&
772 preview_tab_contents_delegate_->is_mouse_down_from_activate(); 772 preview_tab_contents_delegate_->is_mouse_down_from_activate();
773 } 773 }
774 774
775 TabContentsWrapper* InstantLoader::ReleasePreviewContents( 775 TabContents* InstantLoader::ReleasePreviewContents(
776 InstantCommitType type, 776 InstantCommitType type,
777 TabContentsWrapper* tab_contents) { 777 TabContents* tab_contents) {
778 if (!preview_contents_.get()) 778 if (!preview_contents_.get())
779 return NULL; 779 return NULL;
780 780
781 // FrameLoadObserver is only used for instant results, and instant results are 781 // FrameLoadObserver is only used for instant results, and instant results are
782 // only committed if active (when the FrameLoadObserver isn't installed). 782 // only committed if active (when the FrameLoadObserver isn't installed).
783 DCHECK(type == INSTANT_COMMIT_DESTROY || !frame_load_observer_.get()); 783 DCHECK(type == INSTANT_COMMIT_DESTROY || !frame_load_observer_.get());
784 784
785 if (type != INSTANT_COMMIT_DESTROY && is_showing_instant()) { 785 if (type != INSTANT_COMMIT_DESTROY && is_showing_instant()) {
786 RenderViewHost* host = 786 RenderViewHost* host =
787 preview_contents_->web_contents()->GetRenderViewHost(); 787 preview_contents_->web_contents()->GetRenderViewHost();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 } 843 }
844 844
845 bool InstantLoader::ShouldCommitInstantOnMouseUp() { 845 bool InstantLoader::ShouldCommitInstantOnMouseUp() {
846 return delegate_->ShouldCommitInstantOnMouseUp(); 846 return delegate_->ShouldCommitInstantOnMouseUp();
847 } 847 }
848 848
849 void InstantLoader::CommitInstantLoader() { 849 void InstantLoader::CommitInstantLoader() {
850 delegate_->CommitInstantLoader(this); 850 delegate_->CommitInstantLoader(this);
851 } 851 }
852 852
853 void InstantLoader::MaybeLoadInstantURL(TabContentsWrapper* tab_contents, 853 void InstantLoader::MaybeLoadInstantURL(TabContents* tab_contents,
854 const TemplateURL* template_url) { 854 const TemplateURL* template_url) {
855 DCHECK(template_url_id_ == template_url->id()); 855 DCHECK(template_url_id_ == template_url->id());
856 856
857 // If we already have a |preview_contents_|, future search queries will be 857 // If we already have a |preview_contents_|, future search queries will be
858 // issued into it (see the "if (!created_preview_contents)" block in |Update| 858 // issued into it (see the "if (!created_preview_contents)" block in |Update|
859 // above), so there is no need to load the |template_url|'s instant URL. 859 // above), so there is no need to load the |template_url|'s instant URL.
860 if (preview_contents_.get()) 860 if (preview_contents_.get())
861 return; 861 return;
862 862
863 CreatePreviewContents(tab_contents); 863 CreatePreviewContents(tab_contents);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 if (preview_contents_.get() && is_showing_instant() && 1025 if (preview_contents_.get() && is_showing_instant() &&
1026 (force_if_waiting || !is_determining_if_page_supports_instant())) { 1026 (force_if_waiting || !is_determining_if_page_supports_instant())) {
1027 last_omnibox_bounds_ = omnibox_bounds_; 1027 last_omnibox_bounds_ = omnibox_bounds_;
1028 RenderViewHost* host = 1028 RenderViewHost* host =
1029 preview_contents_->web_contents()->GetRenderViewHost(); 1029 preview_contents_->web_contents()->GetRenderViewHost();
1030 host->Send(new ChromeViewMsg_SearchBoxResize( 1030 host->Send(new ChromeViewMsg_SearchBoxResize(
1031 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview())); 1031 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview()));
1032 } 1032 }
1033 } 1033 }
1034 1034
1035 void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc, 1035 void InstantLoader::ReplacePreviewContents(TabContents* old_tc,
1036 TabContentsWrapper* new_tc) { 1036 TabContents* new_tc) {
1037 DCHECK(old_tc == preview_contents_); 1037 DCHECK(old_tc == preview_contents_);
1038 // We release here without deleting so that the caller still has reponsibility 1038 // We release here without deleting so that the caller still has reponsibility
1039 // for deleting the TabContentsWrapper. 1039 // for deleting the TabContents.
1040 ignore_result(preview_contents_.release()); 1040 ignore_result(preview_contents_.release());
1041 preview_contents_.reset(new_tc); 1041 preview_contents_.reset(new_tc);
1042 session_storage_namespace_ = GetSessionStorageNamespace(new_tc); 1042 session_storage_namespace_ = GetSessionStorageNamespace(new_tc);
1043 1043
1044 // Make sure the new preview contents acts like the old one. 1044 // Make sure the new preview contents acts like the old one.
1045 SetupPreviewContents(old_tc); 1045 SetupPreviewContents(old_tc);
1046 1046
1047 // Cleanup the old preview contents. 1047 // Cleanup the old preview contents.
1048 old_tc->constrained_window_tab_helper()->set_delegate(NULL); 1048 old_tc->constrained_window_tab_helper()->set_delegate(NULL);
1049 old_tc->core_tab_helper()->set_delegate(NULL); 1049 old_tc->core_tab_helper()->set_delegate(NULL);
(...skipping 13 matching lines...) Expand all
1063 &old_tc->web_contents()->GetController())); 1063 &old_tc->web_contents()->GetController()));
1064 1064
1065 // We prerendered so we should be ready to show. If we're ready, swap in 1065 // We prerendered so we should be ready to show. If we're ready, swap in
1066 // immediately, otherwise show the preview as normal. 1066 // immediately, otherwise show the preview as normal.
1067 if (ready_) 1067 if (ready_)
1068 delegate_->SwappedTabContents(this); 1068 delegate_->SwappedTabContents(this);
1069 else 1069 else
1070 ShowPreview(); 1070 ShowPreview();
1071 } 1071 }
1072 1072
1073 void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) { 1073 void InstantLoader::SetupPreviewContents(TabContents* tab_contents) {
1074 preview_contents_->web_contents()->SetDelegate( 1074 preview_contents_->web_contents()->SetDelegate(
1075 preview_tab_contents_delegate_.get()); 1075 preview_tab_contents_delegate_.get());
1076 preview_contents_->blocked_content_tab_helper()->SetAllContentsBlocked(true); 1076 preview_contents_->blocked_content_tab_helper()->SetAllContentsBlocked(true);
1077 preview_contents_->constrained_window_tab_helper()->set_delegate( 1077 preview_contents_->constrained_window_tab_helper()->set_delegate(
1078 preview_tab_contents_delegate_.get()); 1078 preview_tab_contents_delegate_.get());
1079 preview_contents_->core_tab_helper()->set_delegate( 1079 preview_contents_->core_tab_helper()->set_delegate(
1080 preview_tab_contents_delegate_.get()); 1080 preview_tab_contents_delegate_.get());
1081 // Disables thumbnailing while the web contents is shown as preview to avoid 1081 // Disables thumbnailing while the web contents is shown as preview to avoid
1082 // generating unnecessary thumbnails. 1082 // generating unnecessary thumbnails.
1083 if (preview_contents_->thumbnail_generator()) 1083 if (preview_contents_->thumbnail_generator())
(...skipping 18 matching lines...) Expand all
1102 this, 1102 this,
1103 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 1103 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
1104 content::Source<NavigationController>( 1104 content::Source<NavigationController>(
1105 &preview_contents_->web_contents()->GetController())); 1105 &preview_contents_->web_contents()->GetController()));
1106 1106
1107 gfx::Rect tab_bounds; 1107 gfx::Rect tab_bounds;
1108 tab_contents->web_contents()->GetView()->GetContainerBounds(&tab_bounds); 1108 tab_contents->web_contents()->GetView()->GetContainerBounds(&tab_bounds);
1109 preview_contents_->web_contents()->GetView()->SizeContents(tab_bounds.size()); 1109 preview_contents_->web_contents()->GetView()->SizeContents(tab_bounds.size());
1110 } 1110 }
1111 1111
1112 void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) { 1112 void InstantLoader::CreatePreviewContents(TabContents* tab_contents) {
1113 WebContents* new_contents = WebContents::Create( 1113 WebContents* new_contents = WebContents::Create(
1114 tab_contents->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); 1114 tab_contents->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
1115 preview_contents_.reset(new TabContentsWrapper(new_contents)); 1115 preview_contents_.reset(new TabContents(new_contents));
1116 AddPreviewUsageForHistogram(template_url_id_, PREVIEW_CREATED, group_); 1116 AddPreviewUsageForHistogram(template_url_id_, PREVIEW_CREATED, group_);
1117 session_storage_namespace_ = GetSessionStorageNamespace(tab_contents); 1117 session_storage_namespace_ = GetSessionStorageNamespace(tab_contents);
1118 preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this)); 1118 preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this));
1119 SetupPreviewContents(tab_contents); 1119 SetupPreviewContents(tab_contents);
1120 1120
1121 preview_contents_->web_contents()->ShowContents(); 1121 preview_contents_->web_contents()->ShowContents();
1122 } 1122 }
1123 1123
1124 void InstantLoader::LoadInstantURL(const TemplateURL* template_url, 1124 void InstantLoader::LoadInstantURL(const TemplateURL* template_url,
1125 content::PageTransition transition_type, 1125 content::PageTransition transition_type,
(...skipping 29 matching lines...) Expand all
1155 host->Send(new ChromeViewMsg_SearchBoxResize( 1155 host->Send(new ChromeViewMsg_SearchBoxResize(
1156 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview())); 1156 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview()));
1157 } else { 1157 } else {
1158 host->Send(new ChromeViewMsg_SearchBoxChange( 1158 host->Send(new ChromeViewMsg_SearchBoxChange(
1159 host->GetRoutingID(), user_text, verbatim, 0, 0)); 1159 host->GetRoutingID(), user_text, verbatim, 0, 0));
1160 } 1160 }
1161 1161
1162 frame_load_observer_.reset(new FrameLoadObserver( 1162 frame_load_observer_.reset(new FrameLoadObserver(
1163 this, preview_contents()->web_contents(), user_text, verbatim)); 1163 this, preview_contents()->web_contents(), user_text, verbatim));
1164 } 1164 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_loader.h ('k') | chrome/browser/instant/instant_unload_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698