OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "components/infobars/core/infobar_delegate.h" | 20 #include "components/infobars/core/infobar_delegate.h" |
| 21 #include "ui/gfx/range/range.h" |
| 22 #include "url/gurl.h" |
21 | 23 |
22 namespace content { | 24 namespace content { |
23 class WebContents; | 25 class WebContents; |
24 } | 26 } |
25 | 27 |
26 class SearchGeolocationDisclosureInfoBarDelegate | 28 class SearchGeolocationDisclosureInfoBarDelegate |
27 : public infobars::InfoBarDelegate { | 29 : public infobars::InfoBarDelegate { |
28 public: | 30 public: |
29 ~SearchGeolocationDisclosureInfoBarDelegate() override; | 31 ~SearchGeolocationDisclosureInfoBarDelegate() override; |
30 | 32 |
31 // Create and show the infobar. | 33 // Create and show the infobar. |
32 static void Create(content::WebContents* web_contents); | 34 static void Create(content::WebContents* web_contents, |
| 35 const GURL& search_url); |
33 | 36 |
34 // Gets the message to display in the infobar. | 37 // The translated text of the message to display. |
35 base::string16 GetMessageText() const; | 38 const base::string16& message_text() const { return message_text_; } |
| 39 |
| 40 // The range of the message that should be a link. |
| 41 const gfx::Range& inline_link_range() const { return inline_link_range_; } |
| 42 |
| 43 // The search URL that caused this infobar to be displayed. |
| 44 const GURL& search_url() const { return search_url_; } |
36 | 45 |
37 private: | 46 private: |
38 SearchGeolocationDisclosureInfoBarDelegate(); | 47 explicit SearchGeolocationDisclosureInfoBarDelegate(const GURL& search_url); |
39 | 48 |
40 // InfoBarDelegate: | 49 // InfoBarDelegate: |
41 Type GetInfoBarType() const override; | 50 Type GetInfoBarType() const override; |
42 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 51 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
43 int GetIconId() const override; | 52 int GetIconId() const override; |
44 | 53 |
| 54 // The translated text of the message to display. |
| 55 base::string16 message_text_; |
| 56 |
| 57 // The range of the message that should be a link. |
| 58 gfx::Range inline_link_range_; |
| 59 |
| 60 // The search URL that caused this infobar to be displayed. |
| 61 GURL search_url_; |
| 62 |
45 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureInfoBarDelegate); | 63 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureInfoBarDelegate); |
46 }; | 64 }; |
47 | 65 |
48 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE
_H_ | 66 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE
_H_ |
OLD | NEW |