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

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

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 preview_tab_contents_delegate_->PrepareForNewLoad(); 1120 preview_tab_contents_delegate_->PrepareForNewLoad();
1121 1121
1122 // Load the instant URL. We don't reflect the url we load in url() as 1122 // Load the instant URL. We don't reflect the url we load in url() as
1123 // callers expect that we're loading the URL they tell us to. 1123 // callers expect that we're loading the URL they tell us to.
1124 // 1124 //
1125 // This uses an empty string for the replacement text as the url doesn't 1125 // This uses an empty string for the replacement text as the url doesn't
1126 // really have the search params, but we need to use the replace 1126 // really have the search params, but we need to use the replace
1127 // functionality so that embeded tags (like {google:baseURL}) are escaped 1127 // functionality so that embeded tags (like {google:baseURL}) are escaped
1128 // correctly. 1128 // correctly.
1129 // TODO(sky): having to use a replaceable url is a bit of a hack here. 1129 // TODO(sky): having to use a replaceable url is a bit of a hack here.
1130 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile( 1130 GURL instant_url(
1131 tab_contents->profile(), string16(), -1, string16())); 1131 template_url->instant_url_ref().ReplaceSearchTermsUsingProfile(
1132 tab_contents->profile(), string16(), -1, string16()));
1132 CommandLine* cl = CommandLine::ForCurrentProcess(); 1133 CommandLine* cl = CommandLine::ForCurrentProcess();
1133 if (cl->HasSwitch(switches::kInstantURL)) 1134 if (cl->HasSwitch(switches::kInstantURL))
1134 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); 1135 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
1135 preview_contents_->web_contents()->GetController().LoadURL( 1136 preview_contents_->web_contents()->GetController().LoadURL(
1136 instant_url, content::Referrer(), transition_type, std::string()); 1137 instant_url, content::Referrer(), transition_type, std::string());
1137 RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost(); 1138 RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost();
1138 preview_contents_->web_contents()->HideContents(); 1139 preview_contents_->web_contents()->HideContents();
1139 1140
1140 // If user_text is empty, this must be a preload of the search homepage. In 1141 // If user_text is empty, this must be a preload of the search homepage. In
1141 // that case, send down a SearchBoxResize message, which will switch the page 1142 // that case, send down a SearchBoxResize message, which will switch the page
1142 // to "search results" UI. This avoids flicker when the page is shown with 1143 // to "search results" UI. This avoids flicker when the page is shown with
1143 // results. In addition, we don't want the page accidentally causing the 1144 // results. In addition, we don't want the page accidentally causing the
1144 // preloaded page to be displayed yet (by calling setSuggestions), so don't 1145 // preloaded page to be displayed yet (by calling setSuggestions), so don't
1145 // send a SearchBoxChange message. 1146 // send a SearchBoxChange message.
1146 if (user_text.empty()) { 1147 if (user_text.empty()) {
1147 host->Send(new ChromeViewMsg_SearchBoxResize( 1148 host->Send(new ChromeViewMsg_SearchBoxResize(
1148 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview())); 1149 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview()));
1149 } else { 1150 } else {
1150 host->Send(new ChromeViewMsg_SearchBoxChange( 1151 host->Send(new ChromeViewMsg_SearchBoxChange(
1151 host->GetRoutingID(), user_text, verbatim, 0, 0)); 1152 host->GetRoutingID(), user_text, verbatim, 0, 0));
1152 } 1153 }
1153 1154
1154 frame_load_observer_.reset(new FrameLoadObserver( 1155 frame_load_observer_.reset(new FrameLoadObserver(
1155 this, preview_contents()->web_contents(), user_text, verbatim)); 1156 this, preview_contents()->web_contents(), user_text, verbatim));
1156 } 1157 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_controller.cc ('k') | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698