| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/ui/webui/options/home_page_overlay_handler.h" | 5 #include "chrome/browser/ui/webui/options/home_page_overlay_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 RegisterTitle(localized_strings, "homePageOverlay", | 42 RegisterTitle(localized_strings, "homePageOverlay", |
| 43 IDS_OPTIONS_HOMEPAGE_TITLE); | 43 IDS_OPTIONS_HOMEPAGE_TITLE); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void HomePageOverlayHandler::RequestAutocompleteSuggestions( | 46 void HomePageOverlayHandler::RequestAutocompleteSuggestions( |
| 47 const base::ListValue* args) { | 47 const base::ListValue* args) { |
| 48 string16 input; | 48 string16 input; |
| 49 CHECK_EQ(args->GetSize(), 1U); | 49 CHECK_EQ(args->GetSize(), 1U); |
| 50 CHECK(args->GetString(0, &input)); | 50 CHECK(args->GetString(0, &input)); |
| 51 | 51 |
| 52 autocomplete_controller_->Start(input, string16(), true, false, false, | 52 autocomplete_controller_->Start(AutocompleteInput( |
| 53 AutocompleteInput::ALL_MATCHES); | 53 input, string16::npos, string16(), true, |
| 54 false, false, AutocompleteInput::ALL_MATCHES)); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
| 57 const AutocompleteResult& result = autocomplete_controller_->result(); | 58 const AutocompleteResult& result = autocomplete_controller_->result(); |
| 58 base::ListValue suggestions; | 59 base::ListValue suggestions; |
| 59 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
| 60 web_ui()->CallJavascriptFunction( | 61 web_ui()->CallJavascriptFunction( |
| 61 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace options | 65 } // namespace options |
| OLD | NEW |