OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE_H_ | |
6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <memory> | |
11 #include <string> | |
12 #include <utility> | |
13 #include <vector> | |
14 | |
15 #include "base/logging.h" | |
16 #include "base/macros.h" | |
17 #include "base/memory/weak_ptr.h" | |
18 #include "base/strings/string16.h" | |
19 #include "base/time/time.h" | |
20 #include "build/build_config.h" | |
21 #include "components/infobars/core/infobar_delegate.h" | |
22 #include "ui/gfx/range/range.h" | |
23 #include "url/gurl.h" | |
24 | |
25 class PrefService; | |
26 | |
27 namespace content { | |
28 class WebContents; | |
29 } | |
30 | |
31 class SearchGeolocationDisclosureInfoBarDelegate | |
32 : public infobars::InfoBarDelegate { | |
33 public: | |
34 ~SearchGeolocationDisclosureInfoBarDelegate() override; | |
35 | |
36 // Create and show the infobar. | |
37 static void Create(content::WebContents* web_contents, | |
38 const GURL& search_url); | |
39 | |
40 // Determine if there is a search geolocation disclosure infobar already open. | |
41 static bool IsSearchGeolocationDisclosureOpen( | |
42 content::WebContents* web_contents); | |
43 | |
44 void RecordSettingsClicked(); | |
45 | |
46 // The translated text of the message to display. | |
47 const base::string16& message_text() const { return message_text_; } | |
48 | |
49 // The range of the message that should be a link. | |
50 const gfx::Range& inline_link_range() const { return inline_link_range_; } | |
51 | |
52 // The search URL that caused this infobar to be displayed. | |
53 const GURL& search_url() const { return search_url_; } | |
54 | |
55 private: | |
56 enum class DisclosureResult; | |
57 | |
58 explicit SearchGeolocationDisclosureInfoBarDelegate( | |
59 content::WebContents* web_contents, | |
60 const GURL& search_url); | |
61 | |
62 // InfoBarDelegate: | |
63 void InfoBarDismissed() override; | |
64 Type GetInfoBarType() const override; | |
65 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | |
66 int GetIconId() const override; | |
67 | |
68 // The translated text of the message to display. | |
69 base::string16 message_text_; | |
70 | |
71 // The range of the message that should be a link. | |
72 gfx::Range inline_link_range_; | |
73 | |
74 // The search URL that caused this infobar to be displayed. | |
75 GURL search_url_; | |
76 | |
77 // The pref service to record prefs in. | |
78 PrefService* pref_service_; | |
79 | |
80 // The result of showing the disclosure. | |
81 DisclosureResult result_; | |
82 | |
83 // The time the infobar was created. | |
84 base::Time creation_time_; | |
85 | |
86 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureInfoBarDelegate); | |
87 }; | |
88 | |
89 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE
_H_ | |
OLD | NEW |