Index: chrome/browser/previews/previews_infobar_delegate.h |
diff --git a/chrome/browser/previews/previews_infobar_delegate.h b/chrome/browser/previews/previews_infobar_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..53b4f5c8f293c8c47792c849598dfe1496179bde |
--- /dev/null |
+++ b/chrome/browser/previews/previews_infobar_delegate.h |
@@ -0,0 +1,64 @@ |
+// 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_DELEGATE_H_ |
+#define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
+ |
+#include "base/macros.h" |
+#include "base/strings/string16.h" |
+#include "components/infobars/core/confirm_infobar_delegate.h" |
Peter Kasting
2016/08/23 19:48:18
This is the only #include we actually need.
Even
megjablon
2016/08/23 23:54:18
Kept macros because it's used by DISALLOW_COPY_AND
Peter Kasting
2016/08/24 03:18:27
Sure, but confirm_infobar_delegate.h pulls that in
megjablon
2016/08/24 21:44:31
Done.
|
+#include "components/infobars/core/infobar_delegate.h" |
+ |
+namespace content { |
+class WebContents; |
+} // namespace content |
Peter Kasting
2016/08/23 19:48:18
Nit: I'd omit the trailing comment here; you omitt
megjablon
2016/08/23 23:54:18
Done.
|
+ |
+namespace data_reduction_proxy { |
+class DataReductionProxySettings; |
+} |
+ |
+class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate { |
+ public: |
+ // The type of the infobar. It controls the strings and records UMA for the |
Peter Kasting
2016/08/23 19:48:18
Nit: An enum can't "record UMA"; do you mean "and
megjablon
2016/08/23 23:54:18
Done.
Peter Kasting
2016/08/24 03:18:27
Consider also updating the comment on Create() tha
megjablon
2016/08/24 21:44:30
Done.
|
+ // type. |
+ enum PreviewsInfoBarType { |
+ LOFI, |
Peter Kasting
2016/08/23 19:48:18
Nit: Consider explaining what these types mean.
megjablon
2016/08/23 23:54:17
Done.
|
+ PREVIEW, // TODO(megjablon): Rename all references to server side previews |
+ OFFLINE, |
+ }; |
+ |
+ // Creates a preview infobar and corresponding delegate and adds the infobar |
+ // to InfoBarService. |infobar_type| controls the strings and records UMA for |
+ // the type. |
+ static void Create(content::WebContents* web_contents, |
+ PreviewsInfoBarType infobar_type); |
+ |
+ ~PreviewsInfoBarDelegate() override; |
Peter Kasting
2016/08/23 19:48:18
Nit: Per Google style guide, destructor goes above
megjablon
2016/08/23 23:54:18
Done.
|
+ |
+ void RemoveInfoBar(); |
+ |
+ private: |
+ class PreviewInfoBarWebContentsObserver; |
+ |
+ PreviewsInfoBarDelegate(content::WebContents* web_contents, |
+ PreviewsInfoBarType infobar_type); |
+ |
+ // InfoBarDelegate overrides: |
+ bool ShouldExpire(const NavigationDetails& details) const override; |
+ |
+ // ConfirmInfoBarDelegate overrides: |
+ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
+ int GetIconId() const override; |
+ base::string16 GetMessageText() const override; |
+ int GetButtons() const override; |
+ base::string16 GetLinkText() const override; |
+ bool LinkClicked(WindowOpenDisposition disposition) override; |
+ |
+ std::unique_ptr<PreviewInfoBarWebContentsObserver> web_contents_observer_; |
+ PreviewsInfoBarType infobar_type_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); |
+}; |
+ |
+#endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |