Commit b77ddff8 authored by kmadhusu@chromium.org's avatar kmadhusu@chromium.org

Change InstantAutocompleteResult::Type to be AutocompleteMatchType::Type.

To pass InstantAutocompleteResult::Type back and forth between the browser and renderer, change the data type to be AutocompleteMatchType::Type instead of an opaque string. 

BUG=239173
TEST=none

Review URL: https://chromiumcodereview.appspot.com/15517007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202017 0039d316-1c4b-4281-b951-d872f2087c98
parent ff7eadd0
......@@ -1861,7 +1861,7 @@ void InstantController::PopulateInstantAutocompleteResultFromMatch(
InstantAutocompleteResult* result) {
DCHECK(result);
result->provider = UTF8ToUTF16(match.provider->GetName());
result->type = UTF8ToUTF16(AutocompleteMatchType::ToString(match.type));
result->type = match.type;
result->description = match.description;
result->destination_url = UTF8ToUTF16(match.destination_url.spec());
......@@ -1874,7 +1874,8 @@ void InstantController::PopulateInstantAutocompleteResultFromMatch(
result->relevance = match.relevance;
result->autocomplete_match_index = autocomplete_match_index;
DVLOG(1) << " " << result->relevance << " " << result->type << " "
DVLOG(1) << " " << result->relevance << " "
<< UTF8ToUTF16(AutocompleteMatchType::ToString(result->type)) << " "
<< result->provider << " " << result->destination_url << " '"
<< result->description << "' '" << result->search_query << "' "
<< result->transition << " " << result->autocomplete_match_index;
......
......@@ -1721,8 +1721,7 @@ IN_PROC_BROWSER_TEST_F(InstantExtendedTest, RestrictedItemReadback) {
InstantAutocompleteResult res;
res.provider = ASCIIToUTF16(AutocompleteProvider::TypeToString(
AutocompleteProvider::TYPE_BUILTIN));
res.type = ASCIIToUTF16(AutocompleteMatchType::ToString(
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED)),
res.type = AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
res.description = ASCIIToUTF16(description);
res.destination_url = ASCIIToUTF16(url);
res.transition = content::PAGE_TRANSITION_TYPED;
......
......@@ -9,6 +9,7 @@
#include <utility>
#include "base/string16.h"
#include "chrome/common/autocomplete_match_type.h"
#include "content/public/common/page_transition_types.h"
#include "googleurl/src/gurl.h"
......@@ -82,8 +83,8 @@ struct InstantAutocompleteResult {
// The provider name, as returned by AutocompleteProvider::GetName().
string16 provider;
// The type of the result, as returned by AutocompleteMatch::TypeToString().
string16 type;
// The type of the result.
AutocompleteMatchType::Type type;
// The description (title), same as AutocompleteMatch::description.
string16 description;
......
......@@ -16,6 +16,7 @@
#include "base/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/common/autocomplete_match_type.h"
#include "chrome/common/common_param_traits.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_pattern.h"
......@@ -117,6 +118,7 @@ struct ParamTraits<ContentSettingsPattern> {
#define IPC_MESSAGE_START ChromeMsgStart
IPC_ENUM_TRAITS(AutocompleteMatchType::Type)
IPC_ENUM_TRAITS(ChromeViewHostMsg_GetPluginInfo_Status::Value)
IPC_ENUM_TRAITS(InstantCompleteBehavior)
IPC_ENUM_TRAITS(InstantSizeUnits)
......
......@@ -9,6 +9,7 @@
#include "base/stringprintf.h"
#include "base/strings/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/autocomplete_match_type.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/instant_types.h"
#include "chrome/common/url_constants.h"
......@@ -143,7 +144,8 @@ v8::Handle<v8::Object> GenerateNativeSuggestion(
const InstantAutocompleteResult& result) {
v8::Handle<v8::Object> obj = v8::Object::New();
obj->Set(v8::String::New("provider"), UTF16ToV8String(result.provider));
obj->Set(v8::String::New("type"), UTF16ToV8String(result.type));
obj->Set(v8::String::New("type"),
UTF8ToV8String(AutocompleteMatchType::ToString(result.type)));
obj->Set(v8::String::New("description"), UTF16ToV8String(result.description));
obj->Set(v8::String::New("destination_url"),
UTF16ToV8String(result.destination_url));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment