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 | |
36 autocomplete_controller_.reset(new AutocompleteController(profile, this)); | 35 autocomplete_controller_.reset(new AutocompleteController(profile, this)); |
37 } | 36 } |
38 | 37 |
39 void HomePageOverlayHandler::GetLocalizedValues( | 38 void HomePageOverlayHandler::GetLocalizedValues( |
40 base::DictionaryValue* localized_strings) { | 39 base::DictionaryValue* localized_strings) { |
41 RegisterTitle(localized_strings, "homePageOverlay", | 40 RegisterTitle(localized_strings, "homePageOverlay", |
42 IDS_OPTIONS2_HOMEPAGE_TITLE); | 41 IDS_OPTIONS2_HOMEPAGE_TITLE); |
43 localized_strings->SetString( | 42 localized_strings->SetString( |
44 "homePageDialogLabel", | 43 "homePageDialogLabel", |
45 l10n_util::GetStringUTF16(IDS_OPTIONS2_HOMEPAGE_DIALOG_LABEL)); | 44 l10n_util::GetStringUTF16(IDS_OPTIONS2_HOMEPAGE_DIALOG_LABEL)); |
(...skipping 11 matching lines...) Expand all Loading... |
57 | 56 |
58 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
59 const AutocompleteResult& result = autocomplete_controller_->result(); | 58 const AutocompleteResult& result = autocomplete_controller_->result(); |
60 base::ListValue suggestions; | 59 base::ListValue suggestions; |
61 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
62 web_ui()->CallJavascriptFunction( | 61 web_ui()->CallJavascriptFunction( |
63 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
64 } | 63 } |
65 | 64 |
66 } // namespace options2 | 65 } // namespace options2 |
OLD | NEW |