| 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 20 matching lines...) Expand all Loading... |
| 31 void HomePageOverlayHandler::RegisterMessages() { | 31 void HomePageOverlayHandler::RegisterMessages() { |
| 32 web_ui()->RegisterMessageCallback( | 32 web_ui()->RegisterMessageCallback( |
| 33 "requestAutocompleteSuggestionsForHomePage", | 33 "requestAutocompleteSuggestionsForHomePage", |
| 34 base::Bind(&HomePageOverlayHandler::RequestAutocompleteSuggestions, | 34 base::Bind(&HomePageOverlayHandler::RequestAutocompleteSuggestions, |
| 35 base::Unretained(this))); | 35 base::Unretained(this))); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void HomePageOverlayHandler::InitializeHandler() { | 38 void HomePageOverlayHandler::InitializeHandler() { |
| 39 Profile* profile = Profile::FromWebUI(web_ui()); | 39 Profile* profile = Profile::FromWebUI(web_ui()); |
| 40 autocomplete_controller_.reset(new AutocompleteController( | 40 autocomplete_controller_.reset(new AutocompleteController( |
| 41 base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), this, | 41 base::MakeUnique<ChromeAutocompleteProviderClient>(profile), this, |
| 42 AutocompleteClassifier::kDefaultOmniboxProviders)); | 42 AutocompleteClassifier::kDefaultOmniboxProviders)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void HomePageOverlayHandler::GetLocalizedValues( | 45 void HomePageOverlayHandler::GetLocalizedValues( |
| 46 base::DictionaryValue* localized_strings) { | 46 base::DictionaryValue* localized_strings) { |
| 47 RegisterTitle(localized_strings, "homePageOverlay", | 47 RegisterTitle(localized_strings, "homePageOverlay", |
| 48 IDS_OPTIONS_HOMEPAGE_TITLE); | 48 IDS_OPTIONS_HOMEPAGE_TITLE); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void HomePageOverlayHandler::RequestAutocompleteSuggestions( | 51 void HomePageOverlayHandler::RequestAutocompleteSuggestions( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 |