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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 IDS_OPTIONS_HOMEPAGE_TITLE); | 48 IDS_OPTIONS_HOMEPAGE_TITLE); |
49 } | 49 } |
50 | 50 |
51 void HomePageOverlayHandler::RequestAutocompleteSuggestions( | 51 void HomePageOverlayHandler::RequestAutocompleteSuggestions( |
52 const base::ListValue* args) { | 52 const base::ListValue* args) { |
53 base::string16 input; | 53 base::string16 input; |
54 CHECK_EQ(args->GetSize(), 1U); | 54 CHECK_EQ(args->GetSize(), 1U); |
55 CHECK(args->GetString(0, &input)); | 55 CHECK(args->GetString(0, &input)); |
56 | 56 |
57 autocomplete_controller_->Start(AutocompleteInput( | 57 autocomplete_controller_->Start(AutocompleteInput( |
58 input, base::string16::npos, std::string(), GURL(), | 58 input, base::string16::npos, std::string(), GURL(), base::string16(), |
59 metrics::OmniboxEventProto::INVALID_SPEC, true, false, false, true, false, | 59 metrics::OmniboxEventProto::INVALID_SPEC, true, false, false, true, false, |
60 ChromeAutocompleteSchemeClassifier(Profile::FromWebUI(web_ui())))); | 60 ChromeAutocompleteSchemeClassifier(Profile::FromWebUI(web_ui())))); |
61 } | 61 } |
62 | 62 |
63 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 63 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
64 const AutocompleteResult& result = autocomplete_controller_->result(); | 64 const AutocompleteResult& result = autocomplete_controller_->result(); |
65 base::ListValue suggestions; | 65 base::ListValue suggestions; |
66 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 66 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
67 web_ui()->CallJavascriptFunctionUnsafe( | 67 web_ui()->CallJavascriptFunctionUnsafe( |
68 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 68 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
69 } | 69 } |
70 | 70 |
71 } // namespace options | 71 } // namespace options |
OLD | NEW |