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

Side by Side Diff: chrome/browser/previews/previews_infobar_tab_helper.h

Issue 2833523002: Adding opt out and previews type information to DRP pingback (Closed)
Patch Set: bengr comments Created 3 years, 8 months 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
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_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_
6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/optional.h"
10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_ping back_client.h"
9 #include "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/browser/web_contents_user_data.h" 12 #include "content/public/browser/web_contents_user_data.h"
11 13
12 // Tracks whether a previews infobar has been shown for a page. Handles showing 14 // Tracks whether a previews infobar has been shown for a page. Handles showing
13 // the infobar when the main frame response indicates a Lite Page. 15 // the infobar when the main frame response indicates a Lite Page.
14 class PreviewsInfoBarTabHelper 16 class PreviewsInfoBarTabHelper
15 : public content::WebContentsObserver, 17 : public content::WebContentsObserver,
16 public content::WebContentsUserData<PreviewsInfoBarTabHelper> { 18 public content::WebContentsUserData<PreviewsInfoBarTabHelper> {
17 public: 19 public:
18 ~PreviewsInfoBarTabHelper() override; 20 ~PreviewsInfoBarTabHelper() override;
19 21
20 // Indicates whether the InfoBar for a preview has been shown for the page. 22 // Indicates whether the InfoBar for a preview has been shown for the page.
21 bool displayed_preview_infobar() const { 23 bool displayed_preview_infobar() const {
22 return displayed_preview_infobar_; 24 return displayed_preview_infobar_;
23 } 25 }
24 26
25 // Sets whether the InfoBar for a preview has been shown for the page. 27 // Sets whether the InfoBar for a preview has been shown for the page.
26 // |displayed_preview_infobar_| is reset to false on 28 // |displayed_preview_infobar_| is reset to false on
27 // DidStartProvisionalLoadForFrame for the main frame. 29 // DidStartProvisionalLoadForFrame for the main frame.
28 void set_displayed_preview_infobar(bool displayed) { 30 void set_displayed_preview_infobar(bool displayed) {
29 displayed_preview_infobar_ = displayed; 31 displayed_preview_infobar_ = displayed;
30 } 32 }
31 33
34 // The data saver page identifier of the current page load.
35 const base::Optional<data_reduction_proxy::NavigationID>&
36 committed_data_saver_navigation_id() {
37 return committed_data_saver_navigation_id_;
38 }
39
32 private: 40 private:
33 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; 41 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>;
34 friend class PreviewsInfoBarTabHelperUnitTest; 42 friend class PreviewsInfoBarTabHelperUnitTest;
35 43
36 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); 44 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents);
37 45
46 // Clears the last navigation from this tab in the pingback client.
47 void ClearLastNavigationAsync() const;
48
38 // Overridden from content::WebContentsObserver: 49 // Overridden from content::WebContentsObserver:
39 void DidFinishNavigation( 50 void DidFinishNavigation(
40 content::NavigationHandle* navigation_handle) override; 51 content::NavigationHandle* navigation_handle) override;
41 52
53 // Stored for use in the destructor.
54 content::BrowserContext* browser_context_;
55
42 // True if the InfoBar for a preview has been shown for the page. 56 // True if the InfoBar for a preview has been shown for the page.
43 bool displayed_preview_infobar_; 57 bool displayed_preview_infobar_;
44 58
59 // The data saver page identifier of the current page load.
60 base::Optional<data_reduction_proxy::NavigationID>
61 committed_data_saver_navigation_id_;
62
45 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); 63 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper);
46 }; 64 };
47 65
48 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ 66 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/previews/previews_infobar_delegate_unittest.cc ('k') | chrome/browser/previews/previews_infobar_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698