sdefresne | 70948d6 | 2015-08-11 10:46:35 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_OMNIBOX_BROWSER_CLIPBOARD_URL_PROVIDER_H_ |
| 6 | #define COMPONENTS_OMNIBOX_BROWSER_CLIPBOARD_URL_PROVIDER_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "components/omnibox/browser/autocomplete_provider.h" |
mpearson | 931028c | 2016-07-01 18:55:11 | [diff] [blame] | 10 | #include "components/omnibox/browser/history_url_provider.h" |
sdefresne | 70948d6 | 2015-08-11 10:46:35 | [diff] [blame] | 11 | |
| 12 | class AutocompleteProviderClient; |
| 13 | class ClipboardRecentContent; |
mpearson | 931028c | 2016-07-01 18:55:11 | [diff] [blame] | 14 | class HistoryURLProvider; |
sdefresne | 70948d6 | 2015-08-11 10:46:35 | [diff] [blame] | 15 | |
| 16 | // Autocomplete provider offering content based on the clipboard's content. |
| 17 | class ClipboardURLProvider : public AutocompleteProvider { |
| 18 | public: |
| 19 | ClipboardURLProvider(AutocompleteProviderClient* client, |
mpearson | 931028c | 2016-07-01 18:55:11 | [diff] [blame] | 20 | HistoryURLProvider* history_url_provider, |
sdefresne | 70948d6 | 2015-08-11 10:46:35 | [diff] [blame] | 21 | ClipboardRecentContent* clipboard_content); |
| 22 | |
| 23 | // AutocompleteProvider implementation. |
| 24 | void Start(const AutocompleteInput& input, bool minimal_changes) override; |
mpearson | ea5016a | 2017-06-01 22:20:32 | [diff] [blame] | 25 | void AddProviderInfo(ProvidersInfo* provider_info) const override; |
sdefresne | 70948d6 | 2015-08-11 10:46:35 | [diff] [blame] | 26 | |
| 27 | private: |
| 28 | ~ClipboardURLProvider() override; |
| 29 | |
| 30 | AutocompleteProviderClient* client_; |
| 31 | ClipboardRecentContent* clipboard_content_; |
| 32 | |
mpearson | 931028c | 2016-07-01 18:55:11 | [diff] [blame] | 33 | // Used for efficiency when creating the verbatim match. Can be NULL. |
| 34 | HistoryURLProvider* history_url_provider_; |
| 35 | |
mpearson | ea5016a | 2017-06-01 22:20:32 | [diff] [blame] | 36 | // The current URL suggested and the number of times it has been offered. |
| 37 | // Used for recording metrics. |
| 38 | GURL current_url_suggested_; |
| 39 | size_t current_url_suggested_times_; |
| 40 | |
sdefresne | 70948d6 | 2015-08-11 10:46:35 | [diff] [blame] | 41 | DISALLOW_COPY_AND_ASSIGN(ClipboardURLProvider); |
| 42 | }; |
| 43 | |
| 44 | #endif // COMPONENTS_OMNIBOX_BROWSER_CLIPBOARD_URL_PROVIDER_H_ |