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

Unified Diff: chrome/browser/previews/previews_infobar_tab_helper.h

Issue 2256383002: Add PreviewsInfoBarTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@newLoFiInfoBarWithoutPercent
Patch Set: avi comment Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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..d971eca34f33c24d5225ec430b08e6c469358959
--- /dev/null
+++ b/chrome/browser/previews/previews_infobar_tab_helper.h
@@ -0,0 +1,53 @@
+// 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;
+}
+
+// Per-tab class to help manage the previews infobar. Handles showing the
+// infobar for LitePages when the main frame response came back with a
bengr 2016/08/31 23:27:04 This seems like an implementation detail. How abou
megjablon 2016/09/08 00:25:15 Done.
+// Chrome-Proxy reponse header that has the "q=preview" directive.
+class PreviewsInfoBarTabHelper
bengr 2016/08/31 23:27:04 This class should have tests.
megjablon 2016/09/08 00:25:15 Tests are added in https://chromiumcodereview.apps
+ : public content::WebContentsObserver,
+ public content::WebContentsUserData<PreviewsInfoBarTabHelper> {
+ public:
+ ~PreviewsInfoBarTabHelper() override;
+
+ // Indicates whether the InfoBar for Data Reduction Proxy preview has been
bengr 2016/08/31 23:27:04 for -> for the Also, what is a DRP preview and ho
megjablon 2016/09/08 00:25:15 Removed. This should just be for all previews, not
+ // shown for the page.
+ bool DisplayedPreviewInfoBar() const;
bengr 2016/08/31 23:27:04 These are just simple getters and setters so they
megjablon 2016/09/08 00:25:15 Done.
+ void SetDisplayedPreviewInfoBar(bool 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 Data Reduction Proxy preview has been shown for
bengr 2016/08/31 23:27:04 for -> for the
megjablon 2016/09/08 00:25:15 Done.
+ // the page.
+ bool displayed_preview_infobar_;
+
+ DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarTabHelper);
+};
+
+#endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_TAB_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698