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/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
11 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 11 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
12 #include "chrome/browser/autocomplete/autocomplete_input.h" | 12 #include "chrome/browser/autocomplete/autocomplete_input.h" |
13 #include "chrome/browser/autocomplete/autocomplete_result.h" | 13 #include "chrome/browser/autocomplete/autocomplete_result.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "components/metrics/proto/omnibox_event.pb.h" |
15 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 | 19 |
19 namespace options { | 20 namespace options { |
20 | 21 |
21 HomePageOverlayHandler::HomePageOverlayHandler() { | 22 HomePageOverlayHandler::HomePageOverlayHandler() { |
22 } | 23 } |
23 | 24 |
24 HomePageOverlayHandler::~HomePageOverlayHandler() { | 25 HomePageOverlayHandler::~HomePageOverlayHandler() { |
(...skipping 19 matching lines...) Expand all Loading... |
44 } | 45 } |
45 | 46 |
46 void HomePageOverlayHandler::RequestAutocompleteSuggestions( | 47 void HomePageOverlayHandler::RequestAutocompleteSuggestions( |
47 const base::ListValue* args) { | 48 const base::ListValue* args) { |
48 base::string16 input; | 49 base::string16 input; |
49 CHECK_EQ(args->GetSize(), 1U); | 50 CHECK_EQ(args->GetSize(), 1U); |
50 CHECK(args->GetString(0, &input)); | 51 CHECK(args->GetString(0, &input)); |
51 | 52 |
52 autocomplete_controller_->Start(AutocompleteInput( | 53 autocomplete_controller_->Start(AutocompleteInput( |
53 input, base::string16::npos, base::string16(), GURL(), | 54 input, base::string16::npos, base::string16(), GURL(), |
54 AutocompleteInput::INVALID_SPEC, true, false, false, true)); | 55 metrics::OmniboxEventProto::INVALID_SPEC, true, false, false, true)); |
55 } | 56 } |
56 | 57 |
57 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { | 58 void HomePageOverlayHandler::OnResultChanged(bool default_match_changed) { |
58 const AutocompleteResult& result = autocomplete_controller_->result(); | 59 const AutocompleteResult& result = autocomplete_controller_->result(); |
59 base::ListValue suggestions; | 60 base::ListValue suggestions; |
60 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); | 61 OptionsUI::ProcessAutocompleteSuggestions(result, &suggestions); |
61 web_ui()->CallJavascriptFunction( | 62 web_ui()->CallJavascriptFunction( |
62 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); | 63 "HomePageOverlay.updateAutocompleteSuggestions", suggestions); |
63 } | 64 } |
64 | 65 |
65 } // namespace options | 66 } // namespace options |
OLD | NEW |