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_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/home_page_overlay_handler2.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 "chrome/browser/autocomplete/autocomplete.h" | 9 #include "chrome/browser/autocomplete/autocomplete.h" |
10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 HomePageOverlayHandler::~HomePageOverlayHandler() { | 23 HomePageOverlayHandler::~HomePageOverlayHandler() { |
24 } | 24 } |
25 | 25 |
26 void HomePageOverlayHandler::RegisterMessages() { | 26 void HomePageOverlayHandler::RegisterMessages() { |
27 web_ui()->RegisterMessageCallback( | 27 web_ui()->RegisterMessageCallback( |
28 "requestAutocompleteSuggestionsForHomePage", | 28 "requestAutocompleteSuggestionsForHomePage", |
29 base::Bind(&HomePageOverlayHandler::RequestAutocompleteSuggestions, | 29 base::Bind(&HomePageOverlayHandler::RequestAutocompleteSuggestions, |
30 base::Unretained(this))); | 30 base::Unretained(this))); |
31 } | 31 } |
32 | 32 |
33 void HomePageOverlayHandler::Initialize() { | 33 void HomePageOverlayHandler::InitializeHandler() { |
34 Profile* profile = Profile::FromWebUI(web_ui()); | 34 Profile* profile = Profile::FromWebUI(web_ui()); |
35 | 35 |
36 autocomplete_controller_.reset(new AutocompleteController(profile, this)); | 36 autocomplete_controller_.reset(new AutocompleteController(profile, this)); |
37 } | 37 } |
38 | 38 |
39 void HomePageOverlayHandler::GetLocalizedValues( | 39 void HomePageOverlayHandler::GetLocalizedValues( |
40 base::DictionaryValue* localized_strings) { | 40 base::DictionaryValue* localized_strings) { |
41 RegisterTitle(localized_strings, "homePageOverlay", | 41 RegisterTitle(localized_strings, "homePageOverlay", |
42 IDS_OPTIONS2_HOMEPAGE_TITLE); | 42 IDS_OPTIONS2_HOMEPAGE_TITLE); |
43 localized_strings->SetString( | 43 localized_strings->SetString( |
(...skipping 13 matching lines...) Expand all Loading... |
57 | 57 |
58 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 58 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
59 const AutocompleteResult& result = autocomplete_controller_->result(); | 59 const AutocompleteResult& result = autocomplete_controller_->result(); |
60 base::ListValue suggestions; | 60 base::ListValue suggestions; |
61 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 61 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
62 web_ui()->CallJavascriptFunction( | 62 web_ui()->CallJavascriptFunction( |
63 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 63 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
64 } | 64 } |
65 | 65 |
66 } // namespace options2 | 66 } // namespace options2 |
OLD | NEW |