Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/android/search_geolocation_disclosure_infobar_delegate.h

Issue 2534363002: Add infobar metrics for the new search geolocation disclosure. (Closed)
Patch Set: LAST -> COUNT Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/search_geolocation_disclosure_infobar_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/time/time.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "components/infobars/core/infobar_delegate.h" 21 #include "components/infobars/core/infobar_delegate.h"
21 #include "ui/gfx/range/range.h" 22 #include "ui/gfx/range/range.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 24
24 class PrefService; 25 class PrefService;
25 26
26 namespace content { 27 namespace content {
27 class WebContents; 28 class WebContents;
28 } 29 }
29 30
30 class SearchGeolocationDisclosureInfoBarDelegate 31 class SearchGeolocationDisclosureInfoBarDelegate
31 : public infobars::InfoBarDelegate { 32 : public infobars::InfoBarDelegate {
32 public: 33 public:
33 ~SearchGeolocationDisclosureInfoBarDelegate() override; 34 ~SearchGeolocationDisclosureInfoBarDelegate() override;
34 35
35 // Create and show the infobar. 36 // Create and show the infobar.
36 static void Create(content::WebContents* web_contents, 37 static void Create(content::WebContents* web_contents,
37 const GURL& search_url); 38 const GURL& search_url);
38 39
39 // Determine if there is a search geolocation disclosure infobar already open. 40 // Determine if there is a search geolocation disclosure infobar already open.
40 static bool IsSearchGeolocationDisclosureOpen( 41 static bool IsSearchGeolocationDisclosureOpen(
41 content::WebContents* web_contents); 42 content::WebContents* web_contents);
42 43
44 void RecordSettingsClicked();
45
43 // The translated text of the message to display. 46 // The translated text of the message to display.
44 const base::string16& message_text() const { return message_text_; } 47 const base::string16& message_text() const { return message_text_; }
45 48
46 // The range of the message that should be a link. 49 // The range of the message that should be a link.
47 const gfx::Range& inline_link_range() const { return inline_link_range_; } 50 const gfx::Range& inline_link_range() const { return inline_link_range_; }
48 51
49 // The search URL that caused this infobar to be displayed. 52 // The search URL that caused this infobar to be displayed.
50 const GURL& search_url() const { return search_url_; } 53 const GURL& search_url() const { return search_url_; }
51 54
52 private: 55 private:
56 enum class DisclosureResult;
57
53 explicit SearchGeolocationDisclosureInfoBarDelegate( 58 explicit SearchGeolocationDisclosureInfoBarDelegate(
54 content::WebContents* web_contents, 59 content::WebContents* web_contents,
55 const GURL& search_url); 60 const GURL& search_url);
56 61
57 // InfoBarDelegate: 62 // InfoBarDelegate:
58 void InfoBarDismissed() override; 63 void InfoBarDismissed() override;
59 Type GetInfoBarType() const override; 64 Type GetInfoBarType() const override;
60 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; 65 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
61 int GetIconId() const override; 66 int GetIconId() const override;
62 67
63 // The translated text of the message to display. 68 // The translated text of the message to display.
64 base::string16 message_text_; 69 base::string16 message_text_;
65 70
66 // The range of the message that should be a link. 71 // The range of the message that should be a link.
67 gfx::Range inline_link_range_; 72 gfx::Range inline_link_range_;
68 73
69 // The search URL that caused this infobar to be displayed. 74 // The search URL that caused this infobar to be displayed.
70 GURL search_url_; 75 GURL search_url_;
71 76
72 // The pref service to record prefs in. 77 // The pref service to record prefs in.
73 PrefService* pref_service_; 78 PrefService* pref_service_;
74 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
75 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureInfoBarDelegate); 86 DISALLOW_COPY_AND_ASSIGN(SearchGeolocationDisclosureInfoBarDelegate);
76 }; 87 };
77 88
78 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE _H_ 89 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE _H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/search_geolocation_disclosure_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698