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

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

Issue 10033017: More misc. cleanups to minimize future refactoring diffs. (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
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 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 1130 GURL instant_url(
1131 template_url->instant_url_ref().ReplaceSearchTermsUsingProfile( 1131 template_url->instant_url_ref().ReplaceSearchTermsUsingProfile(
1132 tab_contents->profile(), string16(), -1, string16())); 1132 tab_contents->profile(), string16(),
1133 TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
1133 CommandLine* cl = CommandLine::ForCurrentProcess(); 1134 CommandLine* cl = CommandLine::ForCurrentProcess();
1134 if (cl->HasSwitch(switches::kInstantURL)) 1135 if (cl->HasSwitch(switches::kInstantURL))
1135 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); 1136 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
1136 preview_contents_->web_contents()->GetController().LoadURL( 1137 preview_contents_->web_contents()->GetController().LoadURL(
1137 instant_url, content::Referrer(), transition_type, std::string()); 1138 instant_url, content::Referrer(), transition_type, std::string());
1138 RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost(); 1139 RenderViewHost* host = preview_contents_->web_contents()->GetRenderViewHost();
1139 preview_contents_->web_contents()->HideContents(); 1140 preview_contents_->web_contents()->HideContents();
1140 1141
1141 // If user_text is empty, this must be a preload of the search homepage. In 1142 // If user_text is empty, this must be a preload of the search homepage. In
1142 // that case, send down a SearchBoxResize message, which will switch the page 1143 // that case, send down a SearchBoxResize message, which will switch the page
1143 // to "search results" UI. This avoids flicker when the page is shown with 1144 // to "search results" UI. This avoids flicker when the page is shown with
1144 // results. In addition, we don't want the page accidentally causing the 1145 // results. In addition, we don't want the page accidentally causing the
1145 // preloaded page to be displayed yet (by calling setSuggestions), so don't 1146 // preloaded page to be displayed yet (by calling setSuggestions), so don't
1146 // send a SearchBoxChange message. 1147 // send a SearchBoxChange message.
1147 if (user_text.empty()) { 1148 if (user_text.empty()) {
1148 host->Send(new ChromeViewMsg_SearchBoxResize( 1149 host->Send(new ChromeViewMsg_SearchBoxResize(
1149 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview())); 1150 host->GetRoutingID(), GetOmniboxBoundsInTermsOfPreview()));
1150 } else { 1151 } else {
1151 host->Send(new ChromeViewMsg_SearchBoxChange( 1152 host->Send(new ChromeViewMsg_SearchBoxChange(
1152 host->GetRoutingID(), user_text, verbatim, 0, 0)); 1153 host->GetRoutingID(), user_text, verbatim, 0, 0));
1153 } 1154 }
1154 1155
1155 frame_load_observer_.reset(new FrameLoadObserver( 1156 frame_load_observer_.reset(new FrameLoadObserver(
1156 this, preview_contents()->web_contents(), user_text, verbatim)); 1157 this, preview_contents()->web_contents(), user_text, verbatim));
1157 } 1158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698