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 = base::GetQuotedJSONString(identity); | 463 std::string escaped_identity; |
| 464 base::JsonDoubleQuote(identity, true, &escaped_identity); |
464 blink::WebString script(UTF8ToUTF16(base::StringPrintf( | 465 blink::WebString script(UTF8ToUTF16(base::StringPrintf( |
465 kDispatchChromeIdentityCheckResult, | 466 kDispatchChromeIdentityCheckResult, |
466 escaped_identity.c_str(), | 467 escaped_identity.c_str(), |
467 identity_match ? "true" : "false"))); | 468 identity_match ? "true" : "false"))); |
468 Dispatch(frame, script); | 469 Dispatch(frame, script); |
469 } | 470 } |
470 | 471 |
471 // static | 472 // static |
472 void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) { | 473 void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) { |
473 Dispatch(frame, kDispatchFocusChangedScript); | 474 Dispatch(frame, kDispatchFocusChangedScript); |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 if (!render_view) return; | 1040 if (!render_view) return; |
1040 | 1041 |
1041 bool display_instant_results = | 1042 bool display_instant_results = |
1042 SearchBox::Get(render_view)->display_instant_results(); | 1043 SearchBox::Get(render_view)->display_instant_results(); |
1043 DVLOG(1) << render_view << " GetDisplayInstantResults" << | 1044 DVLOG(1) << render_view << " GetDisplayInstantResults" << |
1044 display_instant_results; | 1045 display_instant_results; |
1045 args.GetReturnValue().Set(display_instant_results); | 1046 args.GetReturnValue().Set(display_instant_results); |
1046 } | 1047 } |
1047 | 1048 |
1048 } // namespace extensions_v8 | 1049 } // namespace extensions_v8 |
OLD | NEW |