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/options2/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_controller.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
11 #include "chrome/browser/autocomplete/autocomplete_input.h" | 11 #include "chrome/browser/autocomplete/autocomplete_input.h" |
12 #include "chrome/browser/autocomplete/autocomplete_result.h" | 12 #include "chrome/browser/autocomplete/autocomplete_result.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
(...skipping 15 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 void HomePageOverlayHandler::InitializeHandler() { | 33 void HomePageOverlayHandler::InitializeHandler() { |
34 Profile* profile = Profile::FromWebUI(web_ui()); | 34 Profile* profile = Profile::FromWebUI(web_ui()); |
35 autocomplete_controller_.reset(new AutocompleteController(profile, this)); | 35 autocomplete_controller_.reset(new AutocompleteController(profile, this)); |
36 } | 36 } |
37 | 37 |
38 void HomePageOverlayHandler::GetLocalizedValues( | 38 void HomePageOverlayHandler::GetLocalizedValues( |
39 base::DictionaryValue* localized_strings) { | 39 base::DictionaryValue* localized_strings) { |
40 RegisterTitle(localized_strings, "homePageOverlay", | 40 RegisterTitle(localized_strings, "homePageOverlay", |
41 IDS_OPTIONS2_HOMEPAGE_TITLE); | 41 IDS_OPTIONS_HOMEPAGE_TITLE); |
42 } | 42 } |
43 | 43 |
44 void HomePageOverlayHandler::RequestAutocompleteSuggestions( | 44 void HomePageOverlayHandler::RequestAutocompleteSuggestions( |
45 const base::ListValue* args) { | 45 const base::ListValue* args) { |
46 string16 input; | 46 string16 input; |
47 CHECK_EQ(args->GetSize(), 1U); | 47 CHECK_EQ(args->GetSize(), 1U); |
48 CHECK(args->GetString(0, &input)); | 48 CHECK(args->GetString(0, &input)); |
49 | 49 |
50 autocomplete_controller_->Start(input, string16(), true, false, false, | 50 autocomplete_controller_->Start(input, string16(), true, false, false, |
51 AutocompleteInput::ALL_MATCHES); | 51 AutocompleteInput::ALL_MATCHES); |
52 } | 52 } |
53 | 53 |
54 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 54 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
55 const AutocompleteResult& result = autocomplete_controller_->result(); | 55 const AutocompleteResult& result = autocomplete_controller_->result(); |
56 base::ListValue suggestions; | 56 base::ListValue suggestions; |
57 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 57 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
58 web_ui()->CallJavascriptFunction( | 58 web_ui()->CallJavascriptFunction( |
59 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 59 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
60 } | 60 } |
61 | 61 |
62 } // namespace options | 62 } // namespace options |
OLD | NEW |