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

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: moved definition up 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"
9 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/browser/web_contents_user_data.h" 11 #include "content/public/browser/web_contents_user_data.h"
11 12
12 // Tracks whether a previews infobar has been shown for a page. Handles showing 13 // 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. 14 // the infobar when the main frame response indicates a Lite Page.
14 class PreviewsInfoBarTabHelper 15 class PreviewsInfoBarTabHelper
15 : public content::WebContentsObserver, 16 : public content::WebContentsObserver,
16 public content::WebContentsUserData<PreviewsInfoBarTabHelper> { 17 public content::WebContentsUserData<PreviewsInfoBarTabHelper> {
17 public: 18 public:
18 ~PreviewsInfoBarTabHelper() override; 19 ~PreviewsInfoBarTabHelper() override;
19 20
20 // Indicates whether the InfoBar for a preview has been shown for the page. 21 // Indicates whether the InfoBar for a preview has been shown for the page.
21 bool displayed_preview_infobar() const { 22 bool displayed_preview_infobar() const {
22 return displayed_preview_infobar_; 23 return displayed_preview_infobar_;
23 } 24 }
24 25
25 // Sets whether the InfoBar for a preview has been shown for the page. 26 // Sets whether the InfoBar for a preview has been shown for the page.
26 // |displayed_preview_infobar_| is reset to false on 27 // |displayed_preview_infobar_| is reset to false on
27 // DidStartProvisionalLoadForFrame for the main frame. 28 // DidStartProvisionalLoadForFrame for the main frame.
28 void set_displayed_preview_infobar(bool displayed) { 29 void set_displayed_preview_infobar(bool displayed) {
29 displayed_preview_infobar_ = displayed; 30 displayed_preview_infobar_ = displayed;
30 } 31 }
31 32
33 // The data saver page identifier of the current page load.
34 const base::Optional<uint64_t>& committed_data_saver_page_id() {
bengr 2017/04/20 17:36:18 #include <stdint.h>
RyanSturm 2017/04/20 20:25:44 Acknowledged.
35 return committed_data_saver_page_id_;
36 }
37
32 private: 38 private:
33 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; 39 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>;
34 friend class PreviewsInfoBarTabHelperUnitTest; 40 friend class PreviewsInfoBarTabHelperUnitTest;
35 41
36 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); 42 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents);
37 43
38 // Overridden from content::WebContentsObserver: 44 // Overridden from content::WebContentsObserver:
39 void DidFinishNavigation( 45 void DidFinishNavigation(
40 content::NavigationHandle* navigation_handle) override; 46 content::NavigationHandle* navigation_handle) override;
41 47
48 // Stored for use in the destructor.
49 content::BrowserContext* browser_context_;
50 content::WebContents* web_contents_;
51
42 // True if the InfoBar for a preview has been shown for the page. 52 // True if the InfoBar for a preview has been shown for the page.
43 bool displayed_preview_infobar_; 53 bool displayed_preview_infobar_;
44 54
55 // The data saver page identifier of the current page load.
56 base::Optional<uint64_t> committed_data_saver_page_id_;
57
45 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); 58 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper);
46 }; 59 };
47 60
48 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ 61 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698