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

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

Issue 8785004: Change NavigationController::LoadURL to take a Referrer class instead of a GURL as referrer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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) 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>
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 complete_suggested_text_.substr(user_text_.size()); 682 complete_suggested_text_.substr(user_text_.size());
683 } 683 }
684 } else { 684 } else {
685 LoadInstantURL(tab_contents, template_url, transition_type, user_text_, 685 LoadInstantURL(tab_contents, template_url, transition_type, user_text_,
686 verbatim); 686 verbatim);
687 } 687 }
688 } else { 688 } else {
689 DCHECK(template_url_id_ == 0); 689 DCHECK(template_url_id_ == 0);
690 preview_tab_contents_delegate_->PrepareForNewLoad(); 690 preview_tab_contents_delegate_->PrepareForNewLoad();
691 frame_load_observer_.reset(NULL); 691 frame_load_observer_.reset(NULL);
692 preview_contents_->controller().LoadURL(url_, GURL(), transition_type, 692 preview_contents_->controller().LoadURL(url_, content::Referrer(),
693 std::string()); 693 transition_type, std::string());
694 } 694 }
695 return true; 695 return true;
696 } 696 }
697 697
698 void InstantLoader::SetOmniboxBounds(const gfx::Rect& bounds) { 698 void InstantLoader::SetOmniboxBounds(const gfx::Rect& bounds) {
699 if (omnibox_bounds_ == bounds) 699 if (omnibox_bounds_ == bounds)
700 return; 700 return;
701 701
702 // Don't update the page while the mouse is down. http://crbug.com/71952 702 // Don't update the page while the mouse is down. http://crbug.com/71952
703 if (IsMouseDownFromActivate()) 703 if (IsMouseDownFromActivate())
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 // This uses an empty string for the replacement text as the url doesn't 1065 // This uses an empty string for the replacement text as the url doesn't
1066 // really have the search params, but we need to use the replace 1066 // really have the search params, but we need to use the replace
1067 // functionality so that embeded tags (like {google:baseURL}) are escaped 1067 // functionality so that embeded tags (like {google:baseURL}) are escaped
1068 // correctly. 1068 // correctly.
1069 // TODO(sky): having to use a replaceable url is a bit of a hack here. 1069 // TODO(sky): having to use a replaceable url is a bit of a hack here.
1070 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile( 1070 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile(
1071 tab_contents->profile(), *template_url, string16(), -1, string16())); 1071 tab_contents->profile(), *template_url, string16(), -1, string16()));
1072 CommandLine* cl = CommandLine::ForCurrentProcess(); 1072 CommandLine* cl = CommandLine::ForCurrentProcess();
1073 if (cl->HasSwitch(switches::kInstantURL)) 1073 if (cl->HasSwitch(switches::kInstantURL))
1074 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); 1074 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
1075 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type, 1075 preview_contents_->controller().LoadURL(instant_url, content::Referrer(),
1076 std::string()); 1076 transition_type, std::string());
1077 RenderViewHost* host = preview_contents_->render_view_host(); 1077 RenderViewHost* host = preview_contents_->render_view_host();
1078 preview_contents_->tab_contents()->HideContents(); 1078 preview_contents_->tab_contents()->HideContents();
1079 1079
1080 // If user_text is empty, this must be a preload of the search homepage. In 1080 // If user_text is empty, this must be a preload of the search homepage. In
1081 // that case, send down a SearchBoxResize message, which will switch the page 1081 // that case, send down a SearchBoxResize message, which will switch the page
1082 // to "search results" UI. This avoids flicker when the page is shown with 1082 // to "search results" UI. This avoids flicker when the page is shown with
1083 // results. In addition, we don't want the page accidentally causing the 1083 // results. In addition, we don't want the page accidentally causing the
1084 // preloaded page to be displayed yet (by calling setSuggestions), so don't 1084 // preloaded page to be displayed yet (by calling setSuggestions), so don't
1085 // send a SearchBoxChange message. 1085 // send a SearchBoxChange message.
1086 if (user_text.empty()) { 1086 if (user_text.empty()) {
1087 host->Send(new ChromeViewMsg_SearchBoxResize( 1087 host->Send(new ChromeViewMsg_SearchBoxResize(
1088 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); 1088 host->routing_id(), GetOmniboxBoundsInTermsOfPreview()));
1089 } else { 1089 } else {
1090 host->Send(new ChromeViewMsg_SearchBoxChange( 1090 host->Send(new ChromeViewMsg_SearchBoxChange(
1091 host->routing_id(), user_text, verbatim, 0, 0)); 1091 host->routing_id(), user_text, verbatim, 0, 0));
1092 } 1092 }
1093 1093
1094 frame_load_observer_.reset(new FrameLoadObserver( 1094 frame_load_observer_.reset(new FrameLoadObserver(
1095 this, preview_contents()->tab_contents(), user_text, verbatim)); 1095 this, preview_contents()->tab_contents(), user_text, verbatim));
1096 } 1096 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698