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

Side by Side Diff: chrome/browser/previews/previews_infobar_delegate.h

Issue 2250223002: Add InfoBar delegate for previews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add count of infobars shown per session Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
7
8 #include "base/macros.h"
9 #include "base/strings/string16.h"
10 #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.
11 #include "components/infobars/core/infobar_delegate.h"
12
13 namespace content {
14 class WebContents;
15 } // 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.
16
17 namespace data_reduction_proxy {
18 class DataReductionProxySettings;
19 }
20
21 class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate {
22 public:
23 // 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.
24 // type.
25 enum PreviewsInfoBarType {
26 LOFI,
Peter Kasting 2016/08/23 19:48:18 Nit: Consider explaining what these types mean.
megjablon 2016/08/23 23:54:17 Done.
27 PREVIEW, // TODO(megjablon): Rename all references to server side previews
28 OFFLINE,
29 };
30
31 // Creates a preview infobar and corresponding delegate and adds the infobar
32 // to InfoBarService. |infobar_type| controls the strings and records UMA for
33 // the type.
34 static void Create(content::WebContents* web_contents,
35 PreviewsInfoBarType infobar_type);
36
37 ~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.
38
39 void RemoveInfoBar();
40
41 private:
42 class PreviewInfoBarWebContentsObserver;
43
44 PreviewsInfoBarDelegate(content::WebContents* web_contents,
45 PreviewsInfoBarType infobar_type);
46
47 // InfoBarDelegate overrides:
48 bool ShouldExpire(const NavigationDetails& details) const override;
49
50 // ConfirmInfoBarDelegate overrides:
51 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
52 int GetIconId() const override;
53 base::string16 GetMessageText() const override;
54 int GetButtons() const override;
55 base::string16 GetLinkText() const override;
56 bool LinkClicked(WindowOpenDisposition disposition) override;
57
58 std::unique_ptr<PreviewInfoBarWebContentsObserver> web_contents_observer_;
59 PreviewsInfoBarType infobar_type_;
60
61 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate);
62 };
63
64 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698