OLD | NEW |
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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 // correctly. | 1069 // correctly. |
1070 // TODO(sky): having to use a replaceable url is a bit of a hack here. | 1070 // TODO(sky): having to use a replaceable url is a bit of a hack here. |
1071 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile( | 1071 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile( |
1072 tab_contents->profile(), *template_url, string16(), -1, string16())); | 1072 tab_contents->profile(), *template_url, string16(), -1, string16())); |
1073 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1073 CommandLine* cl = CommandLine::ForCurrentProcess(); |
1074 if (cl->HasSwitch(switches::kInstantURL)) | 1074 if (cl->HasSwitch(switches::kInstantURL)) |
1075 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); | 1075 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); |
1076 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type, | 1076 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type, |
1077 std::string()); | 1077 std::string()); |
1078 RenderViewHost* host = preview_contents_->render_view_host(); | 1078 RenderViewHost* host = preview_contents_->render_view_host(); |
| 1079 preview_contents_->tab_contents()->HideContents(); |
1079 | 1080 |
1080 // If user_text is empty, this must be a preload of the search homepage. In | 1081 // 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 | 1082 // 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 | 1083 // 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 | 1084 // 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 | 1085 // preloaded page to be displayed yet (by calling setSuggestions), so don't |
1085 // send a SearchBoxChange message. | 1086 // send a SearchBoxChange message. |
1086 if (user_text.empty()) { | 1087 if (user_text.empty()) { |
1087 host->Send(new ChromeViewMsg_SearchBoxResize( | 1088 host->Send(new ChromeViewMsg_SearchBoxResize( |
1088 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); | 1089 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); |
1089 } else { | 1090 } else { |
1090 host->Send(new ChromeViewMsg_SearchBoxChange( | 1091 host->Send(new ChromeViewMsg_SearchBoxChange( |
1091 host->routing_id(), user_text, verbatim, 0, 0)); | 1092 host->routing_id(), user_text, verbatim, 0, 0)); |
1092 } | 1093 } |
1093 | 1094 |
1094 frame_load_observer_.reset(new FrameLoadObserver( | 1095 frame_load_observer_.reset(new FrameLoadObserver( |
1095 this, preview_contents()->tab_contents(), user_text, verbatim)); | 1096 this, preview_contents()->tab_contents(), user_text, verbatim)); |
1096 } | 1097 } |
OLD | NEW |