| 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_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 "base/optional.h" |
| 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_ping
back_client.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_ping
back_client.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return displayed_preview_infobar_; | 24 return displayed_preview_infobar_; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // 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. |
| 28 // |displayed_preview_infobar_| is reset to false on | 28 // |displayed_preview_infobar_| is reset to false on |
| 29 // DidStartProvisionalLoadForFrame for the main frame. | 29 // DidStartProvisionalLoadForFrame for the main frame. |
| 30 void set_displayed_preview_infobar(bool displayed) { | 30 void set_displayed_preview_infobar(bool displayed) { |
| 31 displayed_preview_infobar_ = displayed; | 31 displayed_preview_infobar_ = displayed; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Sets whether the timestamp on the InfoBar for a preview has been shown for |
| 35 // the page. |displayed_preview_timestamp_| is reset to false on |
| 36 // DidStartProvisionalLoadForFrame for the main frame. |
| 37 void set_displayed_preview_timestamp(bool displayed_preview_timestamp) { |
| 38 displayed_preview_timestamp_ = displayed_preview_timestamp; |
| 39 } |
| 40 |
| 34 // The data saver page identifier of the current page load. | 41 // The data saver page identifier of the current page load. |
| 35 const base::Optional<data_reduction_proxy::NavigationID>& | 42 const base::Optional<data_reduction_proxy::NavigationID>& |
| 36 committed_data_saver_navigation_id() { | 43 committed_data_saver_navigation_id() { |
| 37 return committed_data_saver_navigation_id_; | 44 return committed_data_saver_navigation_id_; |
| 38 } | 45 } |
| 39 | 46 |
| 40 private: | 47 private: |
| 41 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; | 48 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; |
| 42 friend class PreviewsInfoBarTabHelperUnitTest; | 49 friend class PreviewsInfoBarTabHelperUnitTest; |
| 43 | 50 |
| 44 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); | 51 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); |
| 45 | 52 |
| 46 // Clears the last navigation from this tab in the pingback client. | 53 // Clears the last navigation from this tab in the pingback client. |
| 47 void ClearLastNavigationAsync() const; | 54 void ClearLastNavigationAsync() const; |
| 48 | 55 |
| 49 // Overridden from content::WebContentsObserver: | 56 // Overridden from content::WebContentsObserver: |
| 50 void DidFinishNavigation( | 57 void DidFinishNavigation( |
| 51 content::NavigationHandle* navigation_handle) override; | 58 content::NavigationHandle* navigation_handle) override; |
| 52 | 59 |
| 53 // Stored for use in the destructor. | 60 // Stored for use in the destructor. |
| 54 content::BrowserContext* browser_context_; | 61 content::BrowserContext* browser_context_; |
| 55 | 62 |
| 56 // True if the InfoBar for a preview has been shown for the page. | 63 // True if the InfoBar for a preview has been shown for the page. |
| 57 bool displayed_preview_infobar_; | 64 bool displayed_preview_infobar_; |
| 58 | 65 |
| 66 // True if the InfoBar with a timestamp was shown for the page. |
| 67 bool displayed_preview_timestamp_; |
| 68 |
| 59 // The data saver page identifier of the current page load. | 69 // The data saver page identifier of the current page load. |
| 60 base::Optional<data_reduction_proxy::NavigationID> | 70 base::Optional<data_reduction_proxy::NavigationID> |
| 61 committed_data_saver_navigation_id_; | 71 committed_data_saver_navigation_id_; |
| 62 | 72 |
| 63 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); | 73 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); |
| 64 }; | 74 }; |
| 65 | 75 |
| 66 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ | 76 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ |
| OLD | NEW |