| 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.h" | 5 #include "chrome/renderer/searchbox/searchbox.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "chrome/renderer/searchbox/searchbox_extension.h" | 9 #include "chrome/renderer/searchbox/searchbox_extension.h" |
| 10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 suggestions[0].behavior == INSTANT_COMPLETE_REPLACE) { | 44 suggestions[0].behavior == INSTANT_COMPLETE_REPLACE) { |
| 45 query_ = suggestions[0].text; | 45 query_ = suggestions[0].text; |
| 46 verbatim_ = true; | 46 verbatim_ = true; |
| 47 selection_start_ = selection_end_ = query_.size(); | 47 selection_start_ = selection_end_ = query_.size(); |
| 48 } | 48 } |
| 49 // Explicitly allow empty vector to be sent to the browser. | 49 // Explicitly allow empty vector to be sent to the browser. |
| 50 render_view()->Send(new ChromeViewHostMsg_SetSuggestions( | 50 render_view()->Send(new ChromeViewHostMsg_SetSuggestions( |
| 51 render_view()->GetRoutingID(), render_view()->GetPageId(), suggestions)); | 51 render_view()->GetRoutingID(), render_view()->GetPageId(), suggestions)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void SearchBox::ClearQuery() { |
| 55 query_.clear(); |
| 56 } |
| 57 |
| 54 void SearchBox::ShowInstantOverlay(InstantShownReason reason, | 58 void SearchBox::ShowInstantOverlay(InstantShownReason reason, |
| 55 int height, | 59 int height, |
| 56 InstantSizeUnits units) { | 60 InstantSizeUnits units) { |
| 57 render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( | 61 render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( |
| 58 render_view()->GetRoutingID(), render_view()->GetPageId(), reason, | 62 render_view()->GetRoutingID(), render_view()->GetPageId(), reason, |
| 59 height, units)); | 63 height, units)); |
| 60 } | 64 } |
| 61 | 65 |
| 62 void SearchBox::StartCapturingKeyStrokes() { | 66 void SearchBox::StartCapturingKeyStrokes() { |
| 63 render_view()->Send(new ChromeViewHostMsg_StartCapturingKeyStrokes( | 67 render_view()->Send(new ChromeViewHostMsg_StartCapturingKeyStrokes( |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 GURL url = GURL(ostr.str()); | 359 GURL url = GURL(ostr.str()); |
| 356 return UTF8ToUTF16(url.spec()); | 360 return UTF8ToUTF16(url.spec()); |
| 357 } | 361 } |
| 358 | 362 |
| 359 string16 SearchBox::GenerateFaviconUrl(int id) { | 363 string16 SearchBox::GenerateFaviconUrl(int id) { |
| 360 std::ostringstream ostr; | 364 std::ostringstream ostr; |
| 361 ostr << kFaviconUrlPrefix << id; | 365 ostr << kFaviconUrlPrefix << id; |
| 362 GURL url = GURL(ostr.str()); | 366 GURL url = GURL(ostr.str()); |
| 363 return UTF8ToUTF16(url.spec()); | 367 return UTF8ToUTF16(url.spec()); |
| 364 } | 368 } |
| OLD | NEW |