| Index: chrome/renderer/searchbox/searchbox_extension.cc
|
| diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
|
| index 612287b33774cd27541edfbb3f7eab5becfabc3e..13640b3ac53230f3f381db12cdf600ab2133b03b 100644
|
| --- a/chrome/renderer/searchbox/searchbox_extension.cc
|
| +++ b/chrome/renderer/searchbox/searchbox_extension.cc
|
| @@ -222,7 +222,6 @@ static const char kDispatchChromeIdentityCheckResult[] =
|
| " true;"
|
| "}";
|
|
|
| -
|
| static const char kDispatchFocusChangedScript[] =
|
| "if (window.chrome &&"
|
| " window.chrome.embeddedSearch &&"
|
| @@ -234,6 +233,17 @@ static const char kDispatchFocusChangedScript[] =
|
| " true;"
|
| "}";
|
|
|
| +static const char kDispatchHistorySyncCheckResult[] =
|
| + "if (window.chrome &&"
|
| + " window.chrome.embeddedSearch &&"
|
| + " window.chrome.embeddedSearch.newTabPage &&"
|
| + " window.chrome.embeddedSearch.newTabPage.onhistorysynccheckdone &&"
|
| + " typeof window.chrome.embeddedSearch.newTabPage"
|
| + " .onhistorysynccheckdone === 'function') {"
|
| + " window.chrome.embeddedSearch.newTabPage.onhistorysynccheckdone(%s);"
|
| + " true;"
|
| + "}";
|
| +
|
| static const char kDispatchInputCancelScript[] =
|
| "if (window.chrome &&"
|
| " window.chrome.embeddedSearch &&"
|
| @@ -352,6 +362,10 @@ class SearchBoxExtensionWrapper : public v8::Extension {
|
| static void CheckIsUserSignedInToChromeAs(
|
| const v8::FunctionCallbackInfo<v8::Value>& args);
|
|
|
| + // Checks whether the user sync his history.
|
| + static void CheckIsUserSyncingHistory(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args);
|
| +
|
| // Deletes a Most Visited item.
|
| static void DeleteMostVisitedItem(
|
| const v8::FunctionCallbackInfo<v8::Value>& args);
|
| @@ -487,6 +501,16 @@ void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) {
|
| }
|
|
|
| // static
|
| +void SearchBoxExtension::DispatchHistorySyncCheckResult(
|
| + blink::WebFrame* frame,
|
| + bool sync_history) {
|
| + blink::WebString script(base::UTF8ToUTF16(base::StringPrintf(
|
| + kDispatchHistorySyncCheckResult,
|
| + sync_history ? "true" : "false")));
|
| + Dispatch(frame, script);
|
| +}
|
| +
|
| +// static
|
| void SearchBoxExtension::DispatchInputCancel(blink::WebFrame* frame) {
|
| Dispatch(frame, kDispatchInputCancelScript);
|
| }
|
| @@ -545,6 +569,9 @@ SearchBoxExtensionWrapper::GetNativeFunctionTemplate(
|
| if (name->Equals(
|
| v8::String::NewFromUtf8(isolate, "CheckIsUserSignedInToChromeAs")))
|
| return v8::FunctionTemplate::New(isolate, CheckIsUserSignedInToChromeAs);
|
| + if (name->Equals(
|
| + v8::String::NewFromUtf8(isolate, "CheckIsUserSyncingHistory")))
|
| + return v8::FunctionTemplate::New(isolate, CheckIsUserSyncingHistory);
|
| if (name->Equals(v8::String::NewFromUtf8(isolate, "DeleteMostVisitedItem")))
|
| return v8::FunctionTemplate::New(isolate, DeleteMostVisitedItem);
|
| if (name->Equals(v8::String::NewFromUtf8(isolate, "Focus")))
|
| @@ -630,6 +657,16 @@ void SearchBoxExtensionWrapper::CheckIsUserSignedInToChromeAs(
|
| }
|
|
|
| // static
|
| +void SearchBoxExtensionWrapper::CheckIsUserSyncingHistory(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| + content::RenderView* render_view = GetRenderView();
|
| + if (!render_view) return;
|
| +
|
| + DVLOG(1) << render_view << " CheckIsUserSyncingHistory";
|
| + SearchBox::Get(render_view)->CheckIsUserSyncingHistory();
|
| +}
|
| +
|
| +// static
|
| void SearchBoxExtensionWrapper::DeleteMostVisitedItem(
|
| const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| content::RenderView* render_view = GetRenderView();
|
|
|