| Index: chrome/renderer/searchbox.cc
|
| diff --git a/chrome/renderer/searchbox.cc b/chrome/renderer/searchbox.cc
|
| index fc9ee55fc5289d61af8bc23993b92feb40a73711..ccec2d19c36520cb2ef2d4b93ab13573855c33ce 100644
|
| --- a/chrome/renderer/searchbox.cc
|
| +++ b/chrome/renderer/searchbox.cc
|
| @@ -60,23 +60,24 @@ bool SearchBox::OnMessageReceived(const IPC::Message& message) {
|
| return handled;
|
| }
|
|
|
| -void SearchBox::OnChange(const string16& value,
|
| +void SearchBox::OnChange(const std::string& value,
|
| bool verbatim,
|
| - int selection_start,
|
| - int selection_end) {
|
| + size_t selection_start,
|
| + size_t selection_end) {
|
| value_ = value;
|
| verbatim_ = verbatim;
|
| selection_start_ = selection_start;
|
| selection_end_ = selection_end;
|
| - if (!render_view()->GetWebView() || !render_view()->GetWebView()->mainFrame())
|
| - return;
|
| - extensions_v8::SearchBoxExtension::DispatchChange(
|
| - render_view()->GetWebView()->mainFrame());
|
| + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
| + extensions_v8::SearchBoxExtension::DispatchChange(
|
| + render_view()->GetWebView()->mainFrame());
|
| + }
|
| }
|
|
|
| -void SearchBox::OnSubmit(const string16& value, bool verbatim) {
|
| +void SearchBox::OnSubmit(const std::string& value) {
|
| value_ = value;
|
| - verbatim_ = verbatim;
|
| + verbatim_ = true;
|
| + selection_start_ = selection_end_ = value_.size();
|
| if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
| extensions_v8::SearchBoxExtension::DispatchSubmit(
|
| render_view()->GetWebView()->mainFrame());
|
| @@ -84,8 +85,10 @@ void SearchBox::OnSubmit(const string16& value, bool verbatim) {
|
| Reset();
|
| }
|
|
|
| -void SearchBox::OnCancel() {
|
| - verbatim_ = false;
|
| +void SearchBox::OnCancel(const std::string& value) {
|
| + value_ = value;
|
| + verbatim_ = true;
|
| + selection_start_ = selection_end_ = value_.size();
|
| if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
| extensions_v8::SearchBoxExtension::DispatchCancel(
|
| render_view()->GetWebView()->mainFrame());
|
| @@ -101,23 +104,18 @@ void SearchBox::OnResize(const gfx::Rect& bounds) {
|
| render_view()->GetWebView()->mainFrame());
|
| }
|
|
|
| -void SearchBox::OnDetermineIfPageSupportsInstant(const string16& value,
|
| - bool verbatim,
|
| - int selection_start,
|
| - int selection_end) {
|
| - value_ = value;
|
| - verbatim_ = verbatim;
|
| - selection_start_ = selection_start;
|
| - selection_end_ = selection_end;
|
| - bool result = extensions_v8::SearchBoxExtension::PageSupportsInstant(
|
| - render_view()->GetWebView()->mainFrame());
|
| - render_view()->Send(new ChromeViewHostMsg_InstantSupportDetermined(
|
| - render_view()->GetRoutingID(), render_view()->GetPageId(), result));
|
| +void SearchBox::OnDetermineIfPageSupportsInstant() {
|
| + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
|
| + bool result = extensions_v8::SearchBoxExtension::PageSupportsInstant(
|
| + render_view()->GetWebView()->mainFrame());
|
| + render_view()->Send(new ChromeViewHostMsg_InstantSupportDetermined(
|
| + render_view()->GetRoutingID(), render_view()->GetPageId(), result));
|
| + }
|
| }
|
|
|
| void SearchBox::Reset() {
|
| verbatim_ = false;
|
| - value_ = string16();
|
| + value_.clear();
|
| selection_start_ = selection_end_ = 0;
|
| rect_ = gfx::Rect();
|
| }
|
|
|