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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 void HomePageOverlayHandler::RequestAutocompleteSuggestions( | 46 void HomePageOverlayHandler::RequestAutocompleteSuggestions( |
47 const base::ListValue* args) { | 47 const base::ListValue* args) { |
48 base::string16 input; | 48 base::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(AutocompleteInput( | 52 autocomplete_controller_->Start(AutocompleteInput( |
53 input, base::string16::npos, base::string16(), GURL(), | 53 input, base::string16::npos, base::string16(), GURL(), |
54 AutocompleteInput::INVALID_SPEC, true, false, false, true)); | 54 metrics::OmniboxEventProto::INVALID_SPEC, true, false, false, true)); |
55 } | 55 } |
56 | 56 |
57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
58 const AutocompleteResult& result = autocomplete_controller_->result(); | 58 const AutocompleteResult& result = autocomplete_controller_->result(); |
59 base::ListValue suggestions; | 59 base::ListValue suggestions; |
60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
61 web_ui()->CallJavascriptFunction( | 61 web_ui()->CallJavascriptFunction( |
62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
63 } | 63 } |
64 | 64 |
65 } // namespace options | 65 } // namespace options |
OLD | NEW |