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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( | 331 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( |
332 render_view()->GetRoutingID(), page_seq_no_, url, | 332 render_view()->GetRoutingID(), page_seq_no_, url, |
333 disposition, is_most_visited_item_url)); | 333 disposition, is_most_visited_item_url)); |
334 } | 334 } |
335 | 335 |
336 void SearchBox::Paste(const base::string16& text) { | 336 void SearchBox::Paste(const base::string16& text) { |
337 render_view()->Send(new ChromeViewHostMsg_PasteAndOpenDropdown( | 337 render_view()->Send(new ChromeViewHostMsg_PasteAndOpenDropdown( |
338 render_view()->GetRoutingID(), page_seq_no_, text)); | 338 render_view()->GetRoutingID(), page_seq_no_, text)); |
339 } | 339 } |
340 | 340 |
341 void SearchBox::SetVoiceSearchSupported(bool supported) { | |
342 render_view()->Send(new ChromeViewHostMsg_SetVoiceSearchSupported( | |
343 render_view()->GetRoutingID(), page_seq_no_, supported)); | |
344 } | |
345 | |
346 void SearchBox::StartCapturingKeyStrokes() { | 341 void SearchBox::StartCapturingKeyStrokes() { |
347 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( | 342 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( |
348 render_view()->GetRoutingID(), page_seq_no_, OMNIBOX_FOCUS_INVISIBLE)); | 343 render_view()->GetRoutingID(), page_seq_no_, OMNIBOX_FOCUS_INVISIBLE)); |
349 } | 344 } |
350 | 345 |
351 void SearchBox::StopCapturingKeyStrokes() { | 346 void SearchBox::StopCapturingKeyStrokes() { |
352 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( | 347 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( |
353 render_view()->GetRoutingID(), page_seq_no_, OMNIBOX_FOCUS_NONE)); | 348 render_view()->GetRoutingID(), page_seq_no_, OMNIBOX_FOCUS_NONE)); |
354 } | 349 } |
355 | 350 |
(...skipping 29 matching lines...) Expand all Loading... |
385 OnPromoInformationReceived) | 380 OnPromoInformationReceived) |
386 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, | 381 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, |
387 OnSetDisplayInstantResults) | 382 OnSetDisplayInstantResults) |
388 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, | 383 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, |
389 OnSetInputInProgress) | 384 OnSetInputInProgress) |
390 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetSuggestionToPrefetch, | 385 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetSuggestionToPrefetch, |
391 OnSetSuggestionToPrefetch) | 386 OnSetSuggestionToPrefetch) |
392 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) | 387 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) |
393 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, | 388 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, |
394 OnThemeChanged) | 389 OnThemeChanged) |
395 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxToggleVoiceSearch, | |
396 OnToggleVoiceSearch) | |
397 IPC_MESSAGE_UNHANDLED(handled = false) | 390 IPC_MESSAGE_UNHANDLED(handled = false) |
398 IPC_END_MESSAGE_MAP() | 391 IPC_END_MESSAGE_MAP() |
399 return handled; | 392 return handled; |
400 } | 393 } |
401 | 394 |
402 void SearchBox::OnSetPageSequenceNumber(int page_seq_no) { | 395 void SearchBox::OnSetPageSequenceNumber(int page_seq_no) { |
403 page_seq_no_ = page_seq_no; | 396 page_seq_no_ = page_seq_no; |
404 } | 397 } |
405 | 398 |
406 void SearchBox::OnChromeIdentityCheckResult(const base::string16& identity, | 399 void SearchBox::OnChromeIdentityCheckResult(const base::string16& identity, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 if (theme_info_ == theme_info) | 529 if (theme_info_ == theme_info) |
537 return; | 530 return; |
538 | 531 |
539 theme_info_ = theme_info; | 532 theme_info_ = theme_info; |
540 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 533 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
541 extensions_v8::SearchBoxExtension::DispatchThemeChange( | 534 extensions_v8::SearchBoxExtension::DispatchThemeChange( |
542 render_view()->GetWebView()->mainFrame()); | 535 render_view()->GetWebView()->mainFrame()); |
543 } | 536 } |
544 } | 537 } |
545 | 538 |
546 void SearchBox::OnToggleVoiceSearch() { | |
547 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | |
548 extensions_v8::SearchBoxExtension::DispatchToggleVoiceSearch( | |
549 render_view()->GetWebView()->mainFrame()); | |
550 } | |
551 } | |
552 | |
553 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const { | 539 GURL SearchBox::GetURLForMostVisitedItem(InstantRestrictedID item_id) const { |
554 InstantMostVisitedItem item; | 540 InstantMostVisitedItem item; |
555 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL(); | 541 return GetMostVisitedItemWithID(item_id, &item) ? item.url : GURL(); |
556 } | 542 } |
557 | 543 |
558 void SearchBox::Reset() { | 544 void SearchBox::Reset() { |
559 query_.clear(); | 545 query_.clear(); |
560 embedded_search_request_params_ = EmbeddedSearchRequestParams(); | 546 embedded_search_request_params_ = EmbeddedSearchRequestParams(); |
561 suggestion_ = InstantSuggestion(); | 547 suggestion_ = InstantSuggestion(); |
562 start_margin_ = 0; | 548 start_margin_ = 0; |
563 is_focused_ = false; | 549 is_focused_ = false; |
564 is_key_capture_enabled_ = false; | 550 is_key_capture_enabled_ = false; |
565 theme_info_ = ThemeBackgroundInfo(); | 551 theme_info_ = ThemeBackgroundInfo(); |
566 } | 552 } |
OLD | NEW |