| 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::InitializeHandler() { | 33 void HomePageOverlayHandler::InitializePage() { |
| 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_OPTIONS2_HOMEPAGE_TITLE); |
| 42 localized_strings->SetString( | 42 localized_strings->SetString( |
| 43 "homePageDialogLabel", | 43 "homePageDialogLabel", |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 options2 | 65 } // namespace options2 |
| OLD | NEW |