Index: chrome/renderer/searchbox/searchbox_extension.cc |
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc |
index 250915cc22f1f116b01f9c5d1f158a67abe43993..cbcd71c858797c417d0e48d49cd54b8adc246f35 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); |
@@ -491,6 +505,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); |
} |
@@ -549,6 +573,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"))) |
@@ -636,6 +663,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(); |