summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autocomplete/autocomplete.h12
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h1
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup.cc18
-rw-r--r--chrome/test/automation/autocomplete_edit_proxy.h31
4 files changed, 33 insertions, 29 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h
index d60167a..2e26102 100644
--- a/chrome/browser/autocomplete/autocomplete.h
+++ b/chrome/browser/autocomplete/autocomplete.h
@@ -12,6 +12,7 @@
#include "base/ref_counted.h"
#include "base/timer.h"
#include "chrome/common/page_transition_types.h"
+#include "googleurl/src/gurl.h"
#include "googleurl/src/url_parse.h"
// The AutocompleteController is the center of the autocomplete system. A
@@ -125,7 +126,6 @@ struct AutocompleteMatch;
class AutocompleteProvider;
class AutocompleteResult;
class AutocompleteController;
-class GURL;
class HistoryContentsProvider;
class KeywordProvider;
class Profile;
@@ -367,7 +367,7 @@ struct AutocompleteMatch {
// The URL to actually load when the autocomplete item is selected. This URL
// should be canonical so we can compare URLs with strcmp to avoid dupes.
// It may be empty if there is no possible navigation.
- std::wstring destination_url;
+ GURL destination_url;
// The text displayed on the left in the search results
std::wstring contents;
@@ -553,12 +553,12 @@ class AutocompleteResult {
// True when the selection is empty.
bool empty() const {
- return destination_url.empty() && !provider_affinity &&
+ return destination_url.is_empty() && !provider_affinity &&
!is_history_what_you_typed_match;
}
// The desired destination URL.
- std::wstring destination_url;
+ GURL destination_url;
// The desired provider. If we can't find a match with the specified
// |destination_url|, we'll use the best match from this provider.
@@ -619,8 +619,8 @@ class AutocompleteResult {
// "foo" when the user may have meant to navigate there. In cases like this,
// |match| will point to the "search for 'foo'" result, and this function will
// return "http://foo/".
- std::wstring GetAlternateNavURL(const AutocompleteInput& input,
- const_iterator match) const;
+ GURL GetAlternateNavURL(const AutocompleteInput& input,
+ const_iterator match) const;
// Releases the resources associated with this object. Some callers may
// want to perform several searches without creating new results each time.
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index 94623bf..dc7d0a5 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -18,7 +18,6 @@
#include "chrome/common/gfx/chrome_font.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/views/menu.h"
-#include "googleurl/src/gurl.h"
#include "webkit/glue/window_open_disposition.h"
class AutocompletePopupModel;
diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc
index e355813..d9ca65a 100644
--- a/chrome/browser/autocomplete/autocomplete_popup.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup.cc
@@ -277,10 +277,10 @@ void AutocompletePopupView::OnButtonUp(const CPoint& point,
// OpenURL() may close the popup, which will clear the result set and, by
// extension, |match| and its contents. So copy the relevant strings out to
// make sure they stay alive until the call completes.
- const std::wstring url(match.destination_url);
+ const GURL url(match.destination_url);
std::wstring keyword;
const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword);
- edit_view_->OpenURL(url, disposition, match.transition, std::wstring(), line,
+ edit_view_->OpenURL(url, disposition, match.transition, GURL(), line,
is_keyword_hint ? std::wstring() : keyword);
}
@@ -771,10 +771,10 @@ void AutocompletePopupModel::ResetToDefaultMatch() {
SetSelectedLine(result.default_match() - result.begin(), true);
}
-std::wstring AutocompletePopupModel::URLsForCurrentSelection(
+GURL AutocompletePopupModel::URLsForCurrentSelection(
PageTransition::Type* transition,
bool* is_history_what_you_typed_match,
- std::wstring* alternate_nav_url) const {
+ GURL* alternate_nav_url) const {
// We need to use the result on the controller, because if the popup is open,
// the user changes the contents of the edit, and then presses enter before
// any results have been displayed, results_ will be nonempty but wrong. (In
@@ -782,7 +782,7 @@ std::wstring AutocompletePopupModel::URLsForCurrentSelection(
// TODO(pkasting): If manually_selected_match_ moves to the controller, this
// can move to the edit.
if (controller_->result().empty())
- return std::wstring();
+ return GURL();
const AutocompleteResult& result = controller_->result();
AutocompleteResult::const_iterator match;
@@ -804,12 +804,12 @@ std::wstring AutocompletePopupModel::URLsForCurrentSelection(
return match->destination_url;
}
-std::wstring AutocompletePopupModel::URLsForDefaultMatch(
+GURL AutocompletePopupModel::URLsForDefaultMatch(
const std::wstring& text,
const std::wstring& desired_tld,
PageTransition::Type* transition,
bool* is_history_what_you_typed_match,
- std::wstring* alternate_nav_url) {
+ GURL* alternate_nav_url) {
// We had better not already be doing anything, or this call will blow it
// away.
DCHECK(!is_open());
@@ -823,7 +823,7 @@ std::wstring AutocompletePopupModel::URLsForDefaultMatch(
DCHECK(controller_->done());
const AutocompleteResult& result = controller_->result();
if (result.empty())
- return std::wstring();
+ return GURL();
// Get the URLs for the default match.
const AutocompleteResult::const_iterator match = result.default_match();
@@ -961,7 +961,7 @@ void AutocompletePopupModel::Observe(NotificationType type,
match->fill_into_edit.substr(match->inline_autocomplete_offset);
}
// Warm up DNS Prefetch Cache.
- chrome_browser_net::DnsPrefetchUrlString(match->destination_url);
+ chrome_browser_net::DnsPrefetchUrl(match->destination_url);
// We could prefetch the alternate nav URL, if any, but because there
// can be many of these as a user types an initial series of characters,
// the OS DNS cache could suffer eviction problems for minimal gain.
diff --git a/chrome/test/automation/autocomplete_edit_proxy.h b/chrome/test/automation/autocomplete_edit_proxy.h
index 87c8803..fda27f8 100644
--- a/chrome/test/automation/autocomplete_edit_proxy.h
+++ b/chrome/test/automation/autocomplete_edit_proxy.h
@@ -12,6 +12,7 @@
#include "chrome/common/ipc_message.h"
#include "chrome/common/ipc_message_utils.h"
#include "chrome/test/automation/automation_handle_tracker.h"
+#include "googleurl/src/gurl.h"
// The purpose of this class is to act as a serializable version of
// AutocompleteMatch. The reason for this class is because we don't want to
@@ -39,7 +40,7 @@ struct AutocompleteMatchData {
bool deletable;
std::wstring fill_into_edit;
size_t inline_autocomplete_offset;
- std::wstring destination_url;
+ GURL destination_url;
std::wstring contents;
std::wstring description;
bool is_history_what_you_typed_match;
@@ -59,7 +60,7 @@ struct ParamTraits<AutocompleteMatchData> {
m->WriteBool(p.deletable);
m->WriteWString(p.fill_into_edit);
m->WriteSize(p.inline_autocomplete_offset);
- m->WriteWString(p.destination_url);
+ m->WriteString(p.destination_url.possibly_invalid_spec());
m->WriteWString(p.contents);
m->WriteWString(p.description);
m->WriteBool(p.is_history_what_you_typed_match);
@@ -68,17 +69,21 @@ struct ParamTraits<AutocompleteMatchData> {
}
static bool Read(const Message* m, void** iter, param_type* r) {
- return m->ReadString(iter, &r->provider_name) &&
- m->ReadInt(iter, &r->relevance) &&
- m->ReadBool(iter, &r->deletable) &&
- m->ReadWString(iter, &r->fill_into_edit) &&
- m->ReadSize(iter, &r->inline_autocomplete_offset) &&
- m->ReadWString(iter, &r->destination_url) &&
- m->ReadWString(iter, &r->contents) &&
- m->ReadWString(iter, &r->description) &&
- m->ReadBool(iter, &r->is_history_what_you_typed_match) &&
- m->ReadString(iter, &r->type) &&
- m->ReadBool(iter, &r->starred);
+ std::string destination_url;
+ if (!m->ReadString(iter, &r->provider_name) ||
+ !m->ReadInt(iter, &r->relevance) ||
+ !m->ReadBool(iter, &r->deletable) ||
+ !m->ReadWString(iter, &r->fill_into_edit) ||
+ !m->ReadSize(iter, &r->inline_autocomplete_offset) ||
+ !m->ReadString(iter, &destination_url) ||
+ !m->ReadWString(iter, &r->contents) ||
+ !m->ReadWString(iter, &r->description) ||
+ !m->ReadBool(iter, &r->is_history_what_you_typed_match) ||
+ !m->ReadString(iter, &r->type) ||
+ !m->ReadBool(iter, &r->starred))
+ return false;
+ r->destination_url = GURL(destination_url);
+ return true;
}
static void Log(const param_type& p, std::wstring* l) {