| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/searchbox/searchbox_extension.h" | 5 #include "chrome/renderer/searchbox/searchbox_extension.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue( | 453 v8::Handle<v8::Value> v = frame->executeScriptAndReturnValue( |
| 454 blink::WebScriptSource(kSupportsInstantScript)); | 454 blink::WebScriptSource(kSupportsInstantScript)); |
| 455 return !v.IsEmpty() && v->BooleanValue(); | 455 return !v.IsEmpty() && v->BooleanValue(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 // static | 458 // static |
| 459 void SearchBoxExtension::DispatchChromeIdentityCheckResult( | 459 void SearchBoxExtension::DispatchChromeIdentityCheckResult( |
| 460 blink::WebFrame* frame, | 460 blink::WebFrame* frame, |
| 461 const base::string16& identity, | 461 const base::string16& identity, |
| 462 bool identity_match) { | 462 bool identity_match) { |
| 463 std::string escaped_identity; | 463 std::string escaped_identity = base::GetQuotedJSONString(identity); |
| 464 base::JsonDoubleQuote(identity, true, &escaped_identity); | |
| 465 blink::WebString script(UTF8ToUTF16(base::StringPrintf( | 464 blink::WebString script(UTF8ToUTF16(base::StringPrintf( |
| 466 kDispatchChromeIdentityCheckResult, | 465 kDispatchChromeIdentityCheckResult, |
| 467 escaped_identity.c_str(), | 466 escaped_identity.c_str(), |
| 468 identity_match ? "true" : "false"))); | 467 identity_match ? "true" : "false"))); |
| 469 Dispatch(frame, script); | 468 Dispatch(frame, script); |
| 470 } | 469 } |
| 471 | 470 |
| 472 // static | 471 // static |
| 473 void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) { | 472 void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) { |
| 474 Dispatch(frame, kDispatchFocusChangedScript); | 473 Dispatch(frame, kDispatchFocusChangedScript); |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 if (!render_view) return; | 1039 if (!render_view) return; |
| 1041 | 1040 |
| 1042 bool display_instant_results = | 1041 bool display_instant_results = |
| 1043 SearchBox::Get(render_view)->display_instant_results(); | 1042 SearchBox::Get(render_view)->display_instant_results(); |
| 1044 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1043 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
| 1045 display_instant_results; | 1044 display_instant_results; |
| 1046 args.GetReturnValue().Set(display_instant_results); | 1045 args.GetReturnValue().Set(display_instant_results); |
| 1047 } | 1046 } |
| 1048 | 1047 |
| 1049 } // namespace extensions_v8 | 1048 } // namespace extensions_v8 |
| OLD | NEW |