OLD | NEW |
1 // Copyright (c) 2010 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> |
11 | 11 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 // Load the instant URL. We don't reflect the url we load in url() as | 501 // Load the instant URL. We don't reflect the url we load in url() as |
502 // callers expect that we're loading the URL they tell us to. | 502 // callers expect that we're loading the URL they tell us to. |
503 // | 503 // |
504 // This uses an empty string for the replacement text as the url doesn't | 504 // This uses an empty string for the replacement text as the url doesn't |
505 // really have the search params, but we need to use the replace | 505 // really have the search params, but we need to use the replace |
506 // functionality so that embeded tags (like {google:baseURL}) are escaped | 506 // functionality so that embeded tags (like {google:baseURL}) are escaped |
507 // correctly. | 507 // correctly. |
508 // TODO(sky): having to use a replaceable url is a bit of a hack here. | 508 // TODO(sky): having to use a replaceable url is a bit of a hack here. |
509 GURL instant_url( | 509 GURL instant_url( |
510 template_url->instant_url()->ReplaceSearchTerms( | 510 template_url->instant_url()->ReplaceSearchTerms( |
511 *template_url, std::wstring(), -1, std::wstring())); | 511 *template_url, string16(), -1, string16())); |
512 CommandLine* cl = CommandLine::ForCurrentProcess(); | 512 CommandLine* cl = CommandLine::ForCurrentProcess(); |
513 if (cl->HasSwitch(switches::kInstantURL)) | 513 if (cl->HasSwitch(switches::kInstantURL)) |
514 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); | 514 instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); |
515 preview_contents_->controller().LoadURL( | 515 preview_contents_->controller().LoadURL( |
516 instant_url, GURL(), transition_type); | 516 instant_url, GURL(), transition_type); |
517 preview_contents_->render_view_host()->SearchBoxChange( | 517 preview_contents_->render_view_host()->SearchBoxChange( |
518 user_text_, verbatim, 0, 0); | 518 user_text_, verbatim, 0, 0); |
519 frame_load_observer_.reset( | 519 frame_load_observer_.reset( |
520 new FrameLoadObserver(this, | 520 new FrameLoadObserver(this, |
521 preview_contents()->tab_contents(), | 521 preview_contents()->tab_contents(), |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 Source<NavigationController>(&preview_contents_->controller())); | 770 Source<NavigationController>(&preview_contents_->controller())); |
771 #endif | 771 #endif |
772 | 772 |
773 registrar_.Add( | 773 registrar_.Add( |
774 this, | 774 this, |
775 NotificationType::NAV_ENTRY_COMMITTED, | 775 NotificationType::NAV_ENTRY_COMMITTED, |
776 Source<NavigationController>(&preview_contents_->controller())); | 776 Source<NavigationController>(&preview_contents_->controller())); |
777 | 777 |
778 preview_contents_->tab_contents()->ShowContents(); | 778 preview_contents_->tab_contents()->ShowContents(); |
779 } | 779 } |
OLD | NEW |