| Index: chrome/browser/previews/previews_infobar_tab_helper.h | 
| diff --git a/chrome/browser/previews/previews_infobar_tab_helper.h b/chrome/browser/previews/previews_infobar_tab_helper.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..c34f93877179da29e01b5f72bd0ea3fa4cbcee03 | 
| --- /dev/null | 
| +++ b/chrome/browser/previews/previews_infobar_tab_helper.h | 
| @@ -0,0 +1,58 @@ | 
| +// Copyright 2016 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ | 
| +#define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ | 
| + | 
| +#include "base/macros.h" | 
| +#include "content/public/browser/web_contents_observer.h" | 
| +#include "content/public/browser/web_contents_user_data.h" | 
| + | 
| +class GURL; | 
| + | 
| +namespace content { | 
| +class RenderFrameHost; | 
| +} | 
| + | 
| +// Tracks whether a previews infobar has been shown for a page. Handles showing | 
| +// the infobar when the main frame response indicates a Lite Page. | 
| +class PreviewsInfoBarTabHelper | 
| +    : public content::WebContentsObserver, | 
| +      public content::WebContentsUserData<PreviewsInfoBarTabHelper> { | 
| + public: | 
| +  ~PreviewsInfoBarTabHelper() override; | 
| + | 
| +  // Indicates whether the InfoBar for a preview has been shown for the page. | 
| +  bool displayed_preview_infobar() const { | 
| +    return displayed_preview_infobar_; | 
| +  } | 
| + | 
| +  // Sets whether the InfoBar for a preview has been shown for the page. | 
| +  // |displayed_preview_infobar_| is reset to false on | 
| +  // DidStartProvisionalLoadForFrame for the main frame. | 
| +  void set_displayed_preview_infobar(bool displayed) { | 
| +    displayed_preview_infobar_ = displayed; | 
| +  } | 
| + | 
| + private: | 
| +  friend class content::WebContentsUserData<PreviewsInfoBarTabHelper>; | 
| + | 
| +  explicit PreviewsInfoBarTabHelper(content::WebContents* web_contents); | 
| + | 
| +  // Overridden from content::WebContentsObserver: | 
| +  void DidStartProvisionalLoadForFrame( | 
| +      content::RenderFrameHost* render_frame_host, | 
| +      const GURL& validated_url, | 
| +      bool is_error_page, | 
| +      bool is_iframe_srcdoc) override; | 
| +  void DidFinishNavigation( | 
| +      content::NavigationHandle* navigation_handle) override; | 
| + | 
| +  // True if the InfoBar for a preview has been shown for the page. | 
| +  bool displayed_preview_infobar_; | 
| + | 
| +  DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper); | 
| +}; | 
| + | 
| +#endif  // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_ | 
|  |