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

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

Issue 10537154: A working implementation of AQS (Assisted Query Stats). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added Autocomplete unit tests. 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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 1133
1134 // Load the instant URL. We don't reflect the url we load in url() as 1134 // Load the instant URL. We don't reflect the url we load in url() as
1135 // callers expect that we're loading the URL they tell us to. 1135 // callers expect that we're loading the URL they tell us to.
1136 // 1136 //
1137 // This uses an empty string for the replacement text as the url doesn't 1137 // This uses an empty string for the replacement text as the url doesn't
1138 // really have the search params, but we need to use the replace 1138 // really have the search params, but we need to use the replace
1139 // functionality so that embeded tags (like {google:baseURL}) are escaped 1139 // functionality so that embeded tags (like {google:baseURL}) are escaped
1140 // correctly. 1140 // correctly.
1141 // TODO(sky): having to use a replaceable url is a bit of a hack here. 1141 // TODO(sky): having to use a replaceable url is a bit of a hack here.
1142 GURL instant_url(template_url->instant_url_ref().ReplaceSearchTerms( 1142 GURL instant_url(template_url->instant_url_ref().ReplaceSearchTerms(
1143 string16(), TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())); 1143 TemplateURLRef::SearchTermsArgs(string16())));
1144 CommandLine* cl = CommandLine::ForCurrentProcess(); 1144 CommandLine* cl = CommandLine::ForCurrentProcess();
1145 if (cl->HasSwitch(switches::kInstantURL)) 1145 if (cl->HasSwitch(switches::kInstantURL))
1146 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); 1146 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
1147 preview_contents_->web_contents()->GetController().LoadURL( 1147 preview_contents_->web_contents()->GetController().LoadURL(
1148 instant_url, content::Referrer(), transition_type, std::string()); 1148 instant_url, content::Referrer(), transition_type, std::string());
1149 RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost(); 1149 RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost();
1150 preview_contents_->web_contents()->HideContents(); 1150 preview_contents_->web_contents()->HideContents();
1151 1151
1152 // If user_text is empty, this must be a preload of the search homepage. In 1152 // If user_text is empty, this must be a preload of the search homepage. In
1153 // that case, send down a SearchBoxResize message, which will switch the page 1153 // that case, send down a SearchBoxResize message, which will switch the page
1154 // to "search results" UI. This avoids flicker when the page is shown with 1154 // to "search results" UI. This avoids flicker when the page is shown with
1155 // results. In addition, we don't want the page accidentally causing the 1155 // results. In addition, we don't want the page accidentally causing the
1156 // preloaded page to be displayed yet (by calling setSuggestions), so don't 1156 // preloaded page to be displayed yet (by calling setSuggestions), so don't
1157 // send a SearchBoxChange message. 1157 // send a SearchBoxChange message.
1158 if (user_text.empty()) { 1158 if (user_text.empty()) {
1159 host->Send(new ChromeViewMsg_SearchBoxResize( 1159 host->Send(new ChromeViewMsg_SearchBoxResize(
1160 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview())); 1160 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview()));
1161 } else { 1161 } else {
1162 host->Send(new ChromeViewMsg_SearchBoxChange( 1162 host->Send(new ChromeViewMsg_SearchBoxChange(
1163 host->GetRoutingID(), user_text, verbatim, 0, 0)); 1163 host->GetRoutingID(), user_text, verbatim, 0, 0));
1164 } 1164 }
1165 1165
1166 frame_load_observer_.reset(new FrameLoadObserver( 1166 frame_load_observer_.reset(new FrameLoadObserver(
1167 this, preview_contents()->web_contents(), user_text, verbatim)); 1167 this, preview_contents()->web_contents(), user_text, verbatim));
1168 } 1168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698