| 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 "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 return displayed_preview_infobar_; | 28 return displayed_preview_infobar_; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Sets whether the InfoBar for a preview has been shown for the page. | 31 // Sets whether the InfoBar for a preview has been shown for the page. |
| 32 // |displayed_preview_infobar_| is reset to false on | 32 // |displayed_preview_infobar_| is reset to false on |
| 33 // DidStartProvisionalLoadForFrame for the main frame. | 33 // DidStartProvisionalLoadForFrame for the main frame. |
| 34 void set_displayed_preview_infobar(bool displayed) { | 34 void set_displayed_preview_infobar(bool displayed) { |
| 35 displayed_preview_infobar_ = displayed; | 35 displayed_preview_infobar_ = displayed; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Whether an offline preview has been shown for this tab. This will be |
| 39 // accurate from DidFinishNavigation until the next page has finished |
| 40 // navigation. |
| 41 bool is_showing_offline_preview() const { |
| 42 return is_showing_offline_preview_; |
| 43 } |
| 44 |
| 38 private: | 45 private: |
| 39 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; | 46 friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; |
| 40 friend class PreviewsInfoBarTabHelperUnitTest; | 47 friend class PreviewsInfoBarTabHelperUnitTest; |
| 41 | 48 |
| 42 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); | 49 explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); |
| 43 | 50 |
| 44 // Overridden from content::WebContentsObserver: | 51 // Overridden from content::WebContentsObserver: |
| 45 void DidStartProvisionalLoadForFrame( | |
| 46 content::RenderFrameHost* render_frame_host, | |
| 47 const GURL& validated_url, | |
| 48 bool is_error_page, | |
| 49 bool is_iframe_srcdoc) override; | |
| 50 void DidFinishNavigation( | 52 void DidFinishNavigation( |
| 51 content::NavigationHandle* navigation_handle) override; | 53 content::NavigationHandle* navigation_handle) override; |
| 52 | 54 |
| 53 // True if the InfoBar for a preview has been shown for the page. | 55 // True if the InfoBar for a preview has been shown for the page. |
| 54 bool displayed_preview_infobar_; | 56 bool displayed_preview_infobar_; |
| 55 | 57 |
| 58 // Whether an offline preview has been shown for this tab. This will be |
| 59 // accurate from DidFinishNavigation until the next page has finished |
| 60 // navigation. |
| 61 bool is_showing_offline_preview_; |
| 62 |
| 56 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); | 63 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); |
| 57 }; | 64 }; |
| 58 | 65 |
| 59 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ | 66 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ |
| OLD | NEW |