| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (!suggestions.empty() && | 85 if (!suggestions.empty() && |
| 86 suggestions[0].behavior == INSTANT_COMPLETE_REPLACE) { | 86 suggestions[0].behavior == INSTANT_COMPLETE_REPLACE) { |
| 87 SetQuery(suggestions[0].text, true); | 87 SetQuery(suggestions[0].text, true); |
| 88 selection_start_ = selection_end_ = query_.size(); | 88 selection_start_ = selection_end_ = query_.size(); |
| 89 } | 89 } |
| 90 // Explicitly allow empty vector to be sent to the browser. | 90 // Explicitly allow empty vector to be sent to the browser. |
| 91 render_view()->Send(new ChromeViewHostMsg_SetSuggestions( | 91 render_view()->Send(new ChromeViewHostMsg_SetSuggestions( |
| 92 render_view()->GetRoutingID(), render_view()->GetPageId(), suggestions)); | 92 render_view()->GetRoutingID(), render_view()->GetPageId(), suggestions)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void SearchBox::SetVoiceSearchSupported(bool supported) { |
| 96 render_view()->Send(new ChromeViewHostMsg_SetVoiceSearchSupported( |
| 97 render_view()->GetRoutingID(), render_view()->GetPageId(), supported)); |
| 98 } |
| 99 |
| 95 void SearchBox::MarkQueryAsRestricted() { | 100 void SearchBox::MarkQueryAsRestricted() { |
| 96 query_is_restricted_ = true; | 101 query_is_restricted_ = true; |
| 97 query_.clear(); | 102 query_.clear(); |
| 98 } | 103 } |
| 99 | 104 |
| 100 void SearchBox::ShowInstantOverlay(int height, InstantSizeUnits units) { | 105 void SearchBox::ShowInstantOverlay(int height, InstantSizeUnits units) { |
| 101 render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( | 106 render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( |
| 102 render_view()->GetRoutingID(), render_view()->GetPageId(), height, | 107 render_view()->GetRoutingID(), render_view()->GetPageId(), height, |
| 103 units)); | 108 units)); |
| 104 } | 109 } |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 InstantMostVisitedItem item; | 525 InstantMostVisitedItem item; |
| 521 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL(); | 526 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL(); |
| 522 } | 527 } |
| 523 | 528 |
| 524 void SearchBox::OnToggleVoiceSearch() { | 529 void SearchBox::OnToggleVoiceSearch() { |
| 525 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 530 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
| 526 extensions_v8::SearchBoxExtension::DispatchToggleVoiceSearch( | 531 extensions_v8::SearchBoxExtension::DispatchToggleVoiceSearch( |
| 527 render_view()->GetWebView()->mainFrame()); | 532 render_view()->GetWebView()->mainFrame()); |
| 528 } | 533 } |
| 529 } | 534 } |
| OLD | NEW |