| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 SearchBox::IconURLHelper::IconURLHelper() { | 228 SearchBox::IconURLHelper::IconURLHelper() { |
| 229 } | 229 } |
| 230 | 230 |
| 231 SearchBox::IconURLHelper::~IconURLHelper() { | 231 SearchBox::IconURLHelper::~IconURLHelper() { |
| 232 } | 232 } |
| 233 | 233 |
| 234 SearchBox::SearchBox(content::RenderView* render_view) | 234 SearchBox::SearchBox(content::RenderView* render_view) |
| 235 : content::RenderViewObserver(render_view), | 235 : content::RenderViewObserver(render_view), |
| 236 content::RenderViewObserverTracker<SearchBox>(render_view), | 236 content::RenderViewObserverTracker<SearchBox>(render_view), |
| 237 page_seq_no_(0), | 237 page_seq_no_(0), |
| 238 app_launcher_enabled_(false), | |
| 239 is_focused_(false), | 238 is_focused_(false), |
| 240 is_input_in_progress_(false), | 239 is_input_in_progress_(false), |
| 241 is_key_capture_enabled_(false), | 240 is_key_capture_enabled_(false), |
| 242 display_instant_results_(false), | 241 display_instant_results_(false), |
| 243 most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize), | 242 most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize), |
| 244 query_() { | 243 query_() { |
| 245 } | 244 } |
| 246 | 245 |
| 247 SearchBox::~SearchBox() { | 246 SearchBox::~SearchBox() { |
| 248 } | 247 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 OnSetPageSequenceNumber) | 364 OnSetPageSequenceNumber) |
| 366 IPC_MESSAGE_HANDLER(ChromeViewMsg_ChromeIdentityCheckResult, | 365 IPC_MESSAGE_HANDLER(ChromeViewMsg_ChromeIdentityCheckResult, |
| 367 OnChromeIdentityCheckResult) | 366 OnChromeIdentityCheckResult) |
| 368 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, | 367 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, |
| 369 OnDetermineIfPageSupportsInstant) | 368 OnDetermineIfPageSupportsInstant) |
| 370 IPC_MESSAGE_HANDLER(ChromeViewMsg_HistorySyncCheckResult, | 369 IPC_MESSAGE_HANDLER(ChromeViewMsg_HistorySyncCheckResult, |
| 371 OnHistorySyncCheckResult) | 370 OnHistorySyncCheckResult) |
| 372 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged, OnFocusChanged) | 371 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged, OnFocusChanged) |
| 373 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, | 372 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged, |
| 374 OnMostVisitedChanged) | 373 OnMostVisitedChanged) |
| 375 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPromoInformation, | |
| 376 OnPromoInformationReceived) | |
| 377 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, | 374 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, |
| 378 OnSetDisplayInstantResults) | 375 OnSetDisplayInstantResults) |
| 379 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, | 376 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetInputInProgress, |
| 380 OnSetInputInProgress) | 377 OnSetInputInProgress) |
| 381 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetSuggestionToPrefetch, | 378 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetSuggestionToPrefetch, |
| 382 OnSetSuggestionToPrefetch) | 379 OnSetSuggestionToPrefetch) |
| 383 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) | 380 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) |
| 384 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, | 381 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, |
| 385 OnThemeChanged) | 382 OnThemeChanged) |
| 386 IPC_MESSAGE_UNHANDLED(handled = false) | 383 IPC_MESSAGE_UNHANDLED(handled = false) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (AreMostVisitedItemsEqual(last_known_items, items)) | 455 if (AreMostVisitedItemsEqual(last_known_items, items)) |
| 459 return; // Do not send duplicate onmostvisitedchange events. | 456 return; // Do not send duplicate onmostvisitedchange events. |
| 460 | 457 |
| 461 most_visited_items_cache_.AddItems(items); | 458 most_visited_items_cache_.AddItems(items); |
| 462 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 459 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
| 463 extensions_v8::SearchBoxExtension::DispatchMostVisitedChanged( | 460 extensions_v8::SearchBoxExtension::DispatchMostVisitedChanged( |
| 464 render_view()->GetWebView()->mainFrame()); | 461 render_view()->GetWebView()->mainFrame()); |
| 465 } | 462 } |
| 466 } | 463 } |
| 467 | 464 |
| 468 void SearchBox::OnPromoInformationReceived(bool is_app_launcher_enabled) { | |
| 469 app_launcher_enabled_ = is_app_launcher_enabled; | |
| 470 } | |
| 471 | |
| 472 void SearchBox::OnSetDisplayInstantResults(bool display_instant_results) { | 465 void SearchBox::OnSetDisplayInstantResults(bool display_instant_results) { |
| 473 display_instant_results_ = display_instant_results; | 466 display_instant_results_ = display_instant_results; |
| 474 } | 467 } |
| 475 | 468 |
| 476 void SearchBox::OnSetInputInProgress(bool is_input_in_progress) { | 469 void SearchBox::OnSetInputInProgress(bool is_input_in_progress) { |
| 477 if (is_input_in_progress_ != is_input_in_progress) { | 470 if (is_input_in_progress_ != is_input_in_progress) { |
| 478 is_input_in_progress_ = is_input_in_progress; | 471 is_input_in_progress_ = is_input_in_progress; |
| 479 DVLOG(1) << render_view() << " OnSetInputInProgress"; | 472 DVLOG(1) << render_view() << " OnSetInputInProgress"; |
| 480 if (render_view()->GetWebView() && | 473 if (render_view()->GetWebView() && |
| 481 render_view()->GetWebView()->mainFrame()) { | 474 render_view()->GetWebView()->mainFrame()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 embedded_search_request_params_ = EmbeddedSearchRequestParams(); | 527 embedded_search_request_params_ = EmbeddedSearchRequestParams(); |
| 535 suggestion_ = InstantSuggestion(); | 528 suggestion_ = InstantSuggestion(); |
| 536 is_focused_ = false; | 529 is_focused_ = false; |
| 537 is_key_capture_enabled_ = false; | 530 is_key_capture_enabled_ = false; |
| 538 theme_info_ = ThemeBackgroundInfo(); | 531 theme_info_ = ThemeBackgroundInfo(); |
| 539 } | 532 } |
| 540 | 533 |
| 541 void SearchBox::OnDestruct() { | 534 void SearchBox::OnDestruct() { |
| 542 delete this; | 535 delete this; |
| 543 } | 536 } |
| OLD | NEW |