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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 preview_tab_contents_delegate_->PrepareForNewLoad(); | 1016 preview_tab_contents_delegate_->PrepareForNewLoad(); |
1017 | 1017 |
1018 // Load the instant URL. We don't reflect the url we load in url() as | 1018 // Load the instant URL. We don't reflect the url we load in url() as |
1019 // callers expect that we're loading the URL they tell us to. | 1019 // callers expect that we're loading the URL they tell us to. |
1020 // | 1020 // |
1021 // This uses an empty string for the replacement text as the url doesn't | 1021 // This uses an empty string for the replacement text as the url doesn't |
1022 // really have the search params, but we need to use the replace | 1022 // really have the search params, but we need to use the replace |
1023 // functionality so that embeded tags (like {google:baseURL}) are escaped | 1023 // functionality so that embeded tags (like {google:baseURL}) are escaped |
1024 // correctly. | 1024 // correctly. |
1025 // TODO(sky): having to use a replaceable url is a bit of a hack here. | 1025 // TODO(sky): having to use a replaceable url is a bit of a hack here. |
1026 GURL instant_url(template_url->instant_url()->ReplaceSearchTerms( | 1026 GURL instant_url(template_url->instant_url()->ReplaceSearchTermsUsingProfile( |
1027 *template_url, string16(), -1, string16())); | 1027 tab_contents->profile(), *template_url, string16(), -1, string16())); |
1028 CommandLine* cl = CommandLine::ForCurrentProcess(); | 1028 CommandLine* cl = CommandLine::ForCurrentProcess(); |
1029 if (cl->HasSwitch(switches::kInstantURL)) | 1029 if (cl->HasSwitch(switches::kInstantURL)) |
1030 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); | 1030 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); |
1031 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); | 1031 preview_contents_->controller().LoadURL(instant_url, GURL(), transition_type); |
1032 RenderViewHost* host = preview_contents_->render_view_host(); | 1032 RenderViewHost* host = preview_contents_->render_view_host(); |
1033 host->Send(new ViewMsg_SearchBoxChange( | 1033 host->Send(new ViewMsg_SearchBoxChange( |
1034 host->routing_id(), user_text, verbatim, 0, 0)); | 1034 host->routing_id(), user_text, verbatim, 0, 0)); |
1035 frame_load_observer_.reset(new FrameLoadObserver( | 1035 frame_load_observer_.reset(new FrameLoadObserver( |
1036 this, preview_contents()->tab_contents(), user_text, verbatim)); | 1036 this, preview_contents()->tab_contents(), user_text, verbatim)); |
1037 } | 1037 } |
OLD | NEW |