| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 5 #include "chrome/renderer/searchbox/searchbox.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/renderer/searchbox/searchbox_extension.h" | 8 #include "chrome/renderer/searchbox/searchbox_extension.h" |
| 9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 suggestions[0].behavior == INSTANT_COMPLETE_REPLACE) { | 30 suggestions[0].behavior == INSTANT_COMPLETE_REPLACE) { |
| 31 query_ = suggestions[0].text; | 31 query_ = suggestions[0].text; |
| 32 verbatim_ = true; | 32 verbatim_ = true; |
| 33 selection_start_ = selection_end_ = query_.size(); | 33 selection_start_ = selection_end_ = query_.size(); |
| 34 } | 34 } |
| 35 // Explicitly allow empty vector to be sent to the browser. | 35 // Explicitly allow empty vector to be sent to the browser. |
| 36 render_view()->Send(new ChromeViewHostMsg_SetSuggestions( | 36 render_view()->Send(new ChromeViewHostMsg_SetSuggestions( |
| 37 render_view()->GetRoutingID(), render_view()->GetPageId(), suggestions)); | 37 render_view()->GetRoutingID(), render_view()->GetPageId(), suggestions)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SearchBox::OnWebSearchBoxBlur() { |
| 41 render_view()->Send(new ChromeViewHostMsg_OnWebSearchBoxBlur( |
| 42 render_view()->GetRoutingID(), render_view()->GetPageId())); |
| 43 } |
| 44 |
| 45 void SearchBox::OnWebSearchBoxFocus() { |
| 46 render_view()->Send(new ChromeViewHostMsg_OnWebSearchBoxFocus( |
| 47 render_view()->GetRoutingID(), render_view()->GetPageId())); |
| 48 } |
| 49 |
| 40 void SearchBox::ShowInstantPreview(InstantShownReason reason, | 50 void SearchBox::ShowInstantPreview(InstantShownReason reason, |
| 41 int height, | 51 int height, |
| 42 InstantSizeUnits units) { | 52 InstantSizeUnits units) { |
| 43 render_view()->Send(new ChromeViewHostMsg_ShowInstantPreview( | 53 render_view()->Send(new ChromeViewHostMsg_ShowInstantPreview( |
| 44 render_view()->GetRoutingID(), render_view()->GetPageId(), reason, | 54 render_view()->GetRoutingID(), render_view()->GetPageId(), reason, |
| 45 height, units)); | 55 height, units)); |
| 46 } | 56 } |
| 47 | 57 |
| 48 gfx::Rect SearchBox::GetRect() { | 58 gfx::Rect SearchBox::GetRect() { |
| 49 // Need to adjust for scale. | 59 // Need to adjust for scale. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 query_.clear(); | 209 query_.clear(); |
| 200 verbatim_ = false; | 210 verbatim_ = false; |
| 201 selection_start_ = 0; | 211 selection_start_ = 0; |
| 202 selection_end_ = 0; | 212 selection_end_ = 0; |
| 203 results_base_ = 0; | 213 results_base_ = 0; |
| 204 rect_ = gfx::Rect(); | 214 rect_ = gfx::Rect(); |
| 205 autocomplete_results_.clear(); | 215 autocomplete_results_.clear(); |
| 206 is_focused_ = false; | 216 is_focused_ = false; |
| 207 active_tab_is_ntp_ = false; | 217 active_tab_is_ntp_ = false; |
| 208 } | 218 } |
| OLD | NEW |