| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 blink::WebScriptSource(kSupportsInstantScript)); | 499 blink::WebScriptSource(kSupportsInstantScript)); |
| 500 return !v.IsEmpty() && v->BooleanValue(); | 500 return !v.IsEmpty() && v->BooleanValue(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 // static | 503 // static |
| 504 void SearchBoxExtension::DispatchChromeIdentityCheckResult( | 504 void SearchBoxExtension::DispatchChromeIdentityCheckResult( |
| 505 blink::WebFrame* frame, | 505 blink::WebFrame* frame, |
| 506 const base::string16& identity, | 506 const base::string16& identity, |
| 507 bool identity_match) { | 507 bool identity_match) { |
| 508 std::string escaped_identity = base::GetQuotedJSONString(identity); | 508 std::string escaped_identity = base::GetQuotedJSONString(identity); |
| 509 blink::WebString script(base::UTF8ToUTF16(base::StringPrintf( | 509 blink::WebString script(blink::WebString::fromUTF8(base::StringPrintf( |
| 510 kDispatchChromeIdentityCheckResult, | 510 kDispatchChromeIdentityCheckResult, escaped_identity.c_str(), |
| 511 escaped_identity.c_str(), | |
| 512 identity_match ? "true" : "false"))); | 511 identity_match ? "true" : "false"))); |
| 513 Dispatch(frame, script); | 512 Dispatch(frame, script); |
| 514 } | 513 } |
| 515 | 514 |
| 516 // static | 515 // static |
| 517 void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) { | 516 void SearchBoxExtension::DispatchFocusChange(blink::WebFrame* frame) { |
| 518 Dispatch(frame, kDispatchFocusChangedScript); | 517 Dispatch(frame, kDispatchFocusChangedScript); |
| 519 } | 518 } |
| 520 | 519 |
| 521 // static | 520 // static |
| 522 void SearchBoxExtension::DispatchHistorySyncCheckResult( | 521 void SearchBoxExtension::DispatchHistorySyncCheckResult( |
| 523 blink::WebFrame* frame, | 522 blink::WebFrame* frame, |
| 524 bool sync_history) { | 523 bool sync_history) { |
| 525 blink::WebString script(base::UTF8ToUTF16(base::StringPrintf( | 524 blink::WebString script(blink::WebString::fromUTF8(base::StringPrintf( |
| 526 kDispatchHistorySyncCheckResult, | 525 kDispatchHistorySyncCheckResult, sync_history ? "true" : "false"))); |
| 527 sync_history ? "true" : "false"))); | |
| 528 Dispatch(frame, script); | 526 Dispatch(frame, script); |
| 529 } | 527 } |
| 530 | 528 |
| 531 // static | 529 // static |
| 532 void SearchBoxExtension::DispatchInputCancel(blink::WebFrame* frame) { | 530 void SearchBoxExtension::DispatchInputCancel(blink::WebFrame* frame) { |
| 533 Dispatch(frame, kDispatchInputCancelScript); | 531 Dispatch(frame, kDispatchInputCancelScript); |
| 534 } | 532 } |
| 535 | 533 |
| 536 // static | 534 // static |
| 537 void SearchBoxExtension::DispatchInputStart(blink::WebFrame* frame) { | 535 void SearchBoxExtension::DispatchInputStart(blink::WebFrame* frame) { |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 ThrowInvalidParameters(args); | 1126 ThrowInvalidParameters(args); |
| 1129 return; | 1127 return; |
| 1130 } | 1128 } |
| 1131 | 1129 |
| 1132 DVLOG(1) << render_frame << " UndoMostVisitedDeletion"; | 1130 DVLOG(1) << render_frame << " UndoMostVisitedDeletion"; |
| 1133 SearchBox::Get(render_frame) | 1131 SearchBox::Get(render_frame) |
| 1134 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value()); | 1132 ->UndoMostVisitedDeletion(args[0]->ToInteger()->Value()); |
| 1135 } | 1133 } |
| 1136 | 1134 |
| 1137 } // namespace extensions_v8 | 1135 } // namespace extensions_v8 |
| OLD | NEW |