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