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