diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 23:52:43 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 23:52:43 +0000 |
commit | e7a5b787751ed3c1c31f66ae919f11911393b974 (patch) | |
tree | 7627eb287c3e079a240f6cc8f98cf94c36a568b4 /chrome/browser/views | |
parent | 01b9961c2ee639c10b07624d40a73702a9f3d0ec (diff) | |
download | chromium_src-e7a5b787751ed3c1c31f66ae919f11911393b974.zip chromium_src-e7a5b787751ed3c1c31f66ae919f11911393b974.tar.gz chromium_src-e7a5b787751ed3c1c31f66ae919f11911393b974.tar.bz2 |
Make the autocomplete system and various other connected bits of code use GURL instead of wstring where appropriate. Original patch by phajdan.jr@gmail.com, r=me,sky. See http://codereview.chromium.org/13205 .
BUG=715234
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6758 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/edit_keyword_controller.cc | 16 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 10 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.h | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/chrome/browser/views/edit_keyword_controller.cc b/chrome/browser/views/edit_keyword_controller.cc index efbb43e..4eb913f 100644 --- a/chrome/browser/views/edit_keyword_controller.cc +++ b/chrome/browser/views/edit_keyword_controller.cc @@ -296,14 +296,14 @@ bool EditKeywordController::IsURLValid() const { if (!template_ref.IsValid()) return false; - if (template_ref.SupportsReplacement()) { - // If the url has a search term, replace it with a random string and make - // sure the resulting URL is valid. We don't check the validity of the url - // with the search term as that is not necessarily valid. - url = template_ref.ReplaceSearchTerms(TemplateURL(), L"a", - TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()); - } - return GURL(url).is_valid(); + if (!template_ref.SupportsReplacement()) + return GURL(url).is_valid(); + + // If the url has a search term, replace it with a random string and make + // sure the resulting URL is valid. We don't check the validity of the url + // with the search term as that is not necessarily valid. + return template_ref.ReplaceSearchTerms(TemplateURL(), L"a", + TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring()).is_valid(); } std::wstring EditKeywordController::GetURL() const { diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 30a8a8c..eb0a7cc 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -308,19 +308,19 @@ void LocationBarView::OnMouseReleased(const views::MouseEvent& event, } void LocationBarView::OnAutocompleteAccept( - const std::wstring& url, + const GURL& url, WindowOpenDisposition disposition, PageTransition::Type transition, - const std::wstring& alternate_nav_url) { - if (url.empty()) + const GURL& alternate_nav_url) { + if (!url.is_valid()) return; - location_input_ = url; + location_input_ = UTF8ToWide(url.spec()); disposition_ = disposition; transition_ = transition; if (controller_) { - if (alternate_nav_url.empty()) { + if (!alternate_nav_url.is_valid()) { controller_->ExecuteCommand(IDC_OPEN_CURRENT_URL); return; } diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index 089b3c1..c594d54 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -89,10 +89,10 @@ class LocationBarView : public views::View, virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); // AutocompleteEditController - virtual void OnAutocompleteAccept(const std::wstring& url, + virtual void OnAutocompleteAccept(const GURL& url, WindowOpenDisposition disposition, PageTransition::Type transition, - const std::wstring& alternate_nav_url); + const GURL& alternate_nav_url); virtual void OnChanged(); virtual void OnInputInProgress(bool in_progress) { delegate_->OnInputInProgress(in_progress); |