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

Side by Side Diff: components/infobars/core/infobar_delegate.h

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial draft Created 4 years, 11 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 5 #ifndef COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 6 #define COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
7 7
8 #include <vector>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
10 #include "build/build_config.h" 12 #include "build/build_config.h"
11 #include "ui/base/window_open_disposition.h" 13 #include "ui/base/window_open_disposition.h"
14 #include "url/gurl.h"
12 15
13 class ConfirmInfoBarDelegate; 16 class ConfirmInfoBarDelegate;
14 class HungRendererInfoBarDelegate; 17 class HungRendererInfoBarDelegate;
15 class InsecureContentInfoBarDelegate; 18 class InsecureContentInfoBarDelegate;
16 class NativeAppInfoBarDelegate; 19 class NativeAppInfoBarDelegate;
17 class PermissionInfobarDelegate; 20 class PermissionInfobarDelegate;
18 class PopupBlockedInfoBarDelegate; 21 class PopupBlockedInfoBarDelegate;
19 class RegisterProtocolHandlerInfoBarDelegate; 22 class RegisterProtocolHandlerInfoBarDelegate;
20 class ScreenCaptureInfoBarDelegate; 23 class ScreenCaptureInfoBarDelegate;
21 class ThemeInstalledInfoBarDelegate; 24 class ThemeInstalledInfoBarDelegate;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Unique identifier for the entry. 69 // Unique identifier for the entry.
67 int entry_id; 70 int entry_id;
68 // True if it is a navigation to a different page (as opposed to in-page). 71 // True if it is a navigation to a different page (as opposed to in-page).
69 bool is_navigation_to_different_page; 72 bool is_navigation_to_different_page;
70 // True if the entry replaced the existing one. 73 // True if the entry replaced the existing one.
71 bool did_replace_entry; 74 bool did_replace_entry;
72 bool is_reload; 75 bool is_reload;
73 bool is_redirect; 76 bool is_redirect;
74 }; 77 };
75 78
79 // Detailed information that should be shown in the content of the infobar.
80 struct Detail {
81 Detail();
82 ~Detail();
83
84 int icon_id;
85 base::string16 label;
86 base::string16 sub_label;
87 };
88
89 // Descriptive text that should be shown in the content of the infobar.
90 struct Description {
Justin Donnelly 2015/12/30 18:06:37 If we keep this, how about FooterText as a, um, mo
please use gerrit instead 2016/01/07 01:39:25 Not keeping this.
91 Description();
92 ~Description();
93
94 struct Link {
95 Link();
96 ~Link();
97
98 size_t start;
99 size_t end;
100 GURL url;
101 };
102
103 base::string16 text;
104 std::vector<Link> links;
105 };
106
76 // Value to use when the InfoBar has no icon to show. 107 // Value to use when the InfoBar has no icon to show.
77 static const int kNoIconID; 108 static const int kNoIconID;
78 109
79 // Called when the InfoBar that owns this delegate is being destroyed. At 110 // Called when the InfoBar that owns this delegate is being destroyed. At
80 // this point nothing is visible onscreen. 111 // this point nothing is visible onscreen.
81 virtual ~InfoBarDelegate(); 112 virtual ~InfoBarDelegate();
82 113
83 // Returns the type of the infobar. The type determines the appearance (such 114 // Returns the type of the infobar. The type determines the appearance (such
84 // as background color) of the infobar. 115 // as background color) of the infobar.
85 virtual Type GetInfoBarType() const; 116 virtual Type GetInfoBarType() const;
(...skipping 10 matching lines...) Expand all
96 virtual gfx::VectorIconId GetVectorIconId() const; 127 virtual gfx::VectorIconId GetVectorIconId() const;
97 128
98 // Returns the icon to be shown for this InfoBar. If the returned Image is 129 // Returns the icon to be shown for this InfoBar. If the returned Image is
99 // empty, no icon is shown. 130 // empty, no icon is shown.
100 // 131 //
101 // Most subclasses should not override this; override GetIconId() instead 132 // Most subclasses should not override this; override GetIconId() instead
102 // unless the infobar needs to show an image from somewhere other than the 133 // unless the infobar needs to show an image from somewhere other than the
103 // resource bundle as its icon. 134 // resource bundle as its icon.
104 virtual gfx::Image GetIcon() const; 135 virtual gfx::Image GetIcon() const;
105 136
137 // Returns the detailed information to be shown for this InfoBar. If the
138 // vector is empty, the details will not be shown. Not all platforms use this
139 // information.
140 virtual const std::vector<Detail>& GetDetails() const;
141
142 // Returns the descriptive text to be shown for this InfoBar. If the vector is
143 // empty, the description will not be shown. Not all platforms use this
144 // information.
145 virtual const std::vector<Description>& GetDescriptions() const;
146
106 // Returns true if the supplied |delegate| is equal to this one. Equality is 147 // Returns true if the supplied |delegate| is equal to this one. Equality is
107 // left to the implementation to define. This function is called by the 148 // left to the implementation to define. This function is called by the
108 // InfoBarManager when determining whether or not a delegate should be 149 // InfoBarManager when determining whether or not a delegate should be
109 // added because a matching one already exists. If this function returns true, 150 // added because a matching one already exists. If this function returns true,
110 // the InfoBarManager will not add the new delegate because it considers 151 // the InfoBarManager will not add the new delegate because it considers
111 // one to already be present. 152 // one to already be present.
112 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const; 153 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const;
113 154
114 // Returns true if the InfoBar should be closed automatically after the page 155 // Returns true if the InfoBar should be closed automatically after the page
115 // is navigated. By default this returns true if the navigation is to a new 156 // is navigated. By default this returns true if the navigation is to a new
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 189
149 InfoBar* infobar() { return infobar_; } 190 InfoBar* infobar() { return infobar_; }
150 191
151 private: 192 private:
152 // The InfoBar associated with us. 193 // The InfoBar associated with us.
153 InfoBar* infobar_; 194 InfoBar* infobar_;
154 195
155 // The ID of the active navigation entry at the time we became owned. 196 // The ID of the active navigation entry at the time we became owned.
156 int nav_entry_id_; 197 int nav_entry_id_;
157 198
199 std::vector<Detail> empty_details_;
200 std::vector<Description> empty_descriptions_;
201
158 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); 202 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate);
159 }; 203 };
160 204
161 } // namespace infobars 205 } // namespace infobars
162 206
163 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 207 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698