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

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

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a spot. 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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 PAGE_ACTION_TYPE, 53 PAGE_ACTION_TYPE,
54 }; 54 };
55 55
56 enum InfoBarAutomationType { 56 enum InfoBarAutomationType {
57 CONFIRM_INFOBAR, 57 CONFIRM_INFOBAR,
58 PASSWORD_INFOBAR, 58 PASSWORD_INFOBAR,
59 RPH_INFOBAR, 59 RPH_INFOBAR,
60 UNKNOWN_INFOBAR, 60 UNKNOWN_INFOBAR,
61 }; 61 };
62 62
63 // Unique identifier for every InfoBarDelegate subclass.
64 // KEEP IN SYNC WITH THE InfoBarIdentifier ENUM IN histograms.xml.
65 // NEW VALUES MUST BE APPENDED AND AVOID CHANGING ANY PRE-EXISTING VALUES.
66 enum InfoBarIdentifier {
67 INVALID_ID,
Peter Kasting 2015/12/30 01:52:57 I'm inclined to remove "_ID" from every item as I'
gone 2015/12/30 07:29:03 Done.
68 TEST_INFOBAR_ID,
Peter Kasting 2015/12/30 01:52:57 What do you think about putting an explicit "= n"
gone 2015/12/30 07:29:03 Sounds good. Alleviates a few of my concerns abou
69 APP_BANNER_INFOBAR_DELEGATE_ANDROID_ID,
70 APP_BANNER_INFOBAR_DELEGATE_DESKTOP_ID,
71 ANDROID_DOWNLOAD_MANAGER_OVERWRITE_INFOBAR_DELEGATE_ID,
72 CHROME_DOWNLOAD_MANAGER_OVERWRITE_INFOBAR_DELEGATE_ID,
73 DOWNLOAD_REQUEST_INFOBAR_DELEGATE_ANDROID_ID,
74 FULLSCREEN_INFOBAR_DELEGATE_ID,
75 HUNG_PLUGIN_INFOBAR_DELEGATE_ID,
76 HUNG_RENDERER_INFOBAR_DELEGATE_ID,
77 MEDIA_STREAM_INFOBAR_DELEGATE_ANDROID_ID,
78 MEDIA_THROTTLE_INFOBAR_DELEGATE_ID,
79 REQUEST_QUOTA_INFOBAR_DELEGATE_ID,
80 DEV_TOOLS_CONFIRM_INFOBAR_DELEGATE_ID,
81 EXTENSION_DEV_TOOLS_INFOBAR_DELEGATE_ID,
82 INCOGNITO_CONNECTABILITY_INFOBAR_DELEGATE_ID,
83 THEME_INSTALLED_INFOBAR_DELEGATE_ID,
84 GEOLOCATION_INFOBAR_DELEGATE_ANDROID_ID,
85 THREE_D_API_INFOBAR_DELEGATE_ID,
86 INSECURE_CONTENT_INFOBAR_DELEGATE_ID,
87 MIDI_PERMISSION_INFOBAR_DELEGATE_ANDROID_ID,
88 PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_ANDROID_ID,
89 NACL_INFOBAR_DELEGATE_ID,
90 DATA_REDUCTION_PROXY_INFOBAR_DELEGATE_ANDROID_ID,
91 NOTIFICATION_PERMISSION_INFOBAR_DELEGATE_ID,
92 AUTO_SIGNIN_FIRST_RUN_INFOBAR_DELEGATE_ID,
93 GENERATED_PASSWORD_SAVED_INFOBAR_DELEGATE_ANDROID_ID,
94 SAVE_PASSWORD_INFOBAR_DELEGATE_ID,
95 PEPPER_BROKER_INFOBAR_DELEGATE_ID,
96 PERMISSION_UPDATE_INFOBAR_DELEGATE_ID,
97 DURABLE_STORAGE_PERMISSION_INFOBAR_DELEGATE_ANDROID_ID,
98 NPAPI_REMOVAL_INFOBAR_DELEGATE_ID,
99 OUTDATED_PLUGIN_INFOBAR_DELEGATE_ID,
100 PLUGIN_METRO_MODE_INFOBAR_DELEGATE_ID,
101 RELOAD_PLUGIN_INFOBAR_DELEGATE_ID,
102 PLUGIN_OBSERVER_ID,
103 SSL_ADD_CERTIFICATE_ID,
104 SSL_ADD_CERTIFICATE_INFOBAR_DELEGATE_ID,
105 POPUP_BLOCKED_INFOBAR_DELEGATE_ID,
106 CHROME_SELECT_FILE_POLICY_ID,
107 KEYSTONE_PROMOTION_INFOBAR_DELEGATE_ID,
108 COLLECTED_COOKIES_INFOBAR_DELEGATE_ID,
109 INSTALLATION_ERROR_INFOBAR_DELEGATE_ID,
110 ALTERNATE_NAV_INFOBAR_DELEGATE_ID,
111 BAD_FLAGS_PROMPT_ID,
112 DEFAULT_BROWSER_INFOBAR_DELEGATE_ID,
113 GOOGLE_API_KEYS_INFOBAR_DELEGATE_ID,
114 OBSOLETE_SYSTEM_INFOBAR_DELEGATE_ID,
115 SESSION_CRASHED_INFOBAR_DELEGATE_ID,
116 WEBSITE_SETTINGS_INFOBAR_DELEGATE_ID,
117 AUTOFILL_CC_INFOBAR_DELEGATE_ID,
118 TRANSLATE_INFOBAR_DELEGATE_ID,
119 IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE_ID
120 };
121
63 // Describes navigation events, used to decide whether infobars should be 122 // Describes navigation events, used to decide whether infobars should be
64 // dismissed. 123 // dismissed.
65 struct NavigationDetails { 124 struct NavigationDetails {
66 // Unique identifier for the entry. 125 // Unique identifier for the entry.
67 int entry_id; 126 int entry_id;
68 // True if it is a navigation to a different page (as opposed to in-page). 127 // True if it is a navigation to a different page (as opposed to in-page).
69 bool is_navigation_to_different_page; 128 bool is_navigation_to_different_page;
70 // True if the entry replaced the existing one. 129 // True if the entry replaced the existing one.
71 bool did_replace_entry; 130 bool did_replace_entry;
72 bool is_reload; 131 bool is_reload;
73 bool is_redirect; 132 bool is_redirect;
74 }; 133 };
75 134
76 // Value to use when the InfoBar has no icon to show. 135 // Value to use when the InfoBar has no icon to show.
77 static const int kNoIconID; 136 static const int kNoIconID;
78 137
79 // Called when the InfoBar that owns this delegate is being destroyed. At 138 // Called when the InfoBar that owns this delegate is being destroyed. At
80 // this point nothing is visible onscreen. 139 // this point nothing is visible onscreen.
81 virtual ~InfoBarDelegate(); 140 virtual ~InfoBarDelegate();
82 141
83 // Returns the type of the infobar. The type determines the appearance (such 142 // Returns the type of the infobar. The type determines the appearance (such
84 // as background color) of the infobar. 143 // as background color) of the infobar.
85 virtual Type GetInfoBarType() const; 144 virtual Type GetInfoBarType() const;
86 145
146 // Returns a unique value identifying the infobar.
147 // New implementers must append a new value to the InfoBarIdentifier enum here
148 // and in histograms.xml.
149 virtual InfoBarIdentifier GetIdentifier() const = 0;
150
87 virtual InfoBarAutomationType GetInfoBarAutomationType() const; 151 virtual InfoBarAutomationType GetInfoBarAutomationType() const;
88 152
89 // Returns the resource ID of the icon to be shown for this InfoBar. If the 153 // Returns the resource ID of the icon to be shown for this InfoBar. If the
90 // value is equal to |kNoIconID|, GetIcon() will not show an icon by default. 154 // value is equal to |kNoIconID|, GetIcon() will not show an icon by default.
91 virtual int GetIconId() const; 155 virtual int GetIconId() const;
92 156
93 // Returns the vector icon identifier to be shown for this InfoBar. This will 157 // Returns the vector icon identifier to be shown for this InfoBar. This will
94 // take precedence over GetIconId() (although typically only one of the two 158 // take precedence over GetIconId() (although typically only one of the two
95 // should be defined for any given infobar). 159 // should be defined for any given infobar).
96 virtual gfx::VectorIconId GetVectorIconId() const; 160 virtual gfx::VectorIconId GetVectorIconId() const;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 218
155 // The ID of the active navigation entry at the time we became owned. 219 // The ID of the active navigation entry at the time we became owned.
156 int nav_entry_id_; 220 int nav_entry_id_;
157 221
158 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate); 222 DISALLOW_COPY_AND_ASSIGN(InfoBarDelegate);
159 }; 223 };
160 224
161 } // namespace infobars 225 } // namespace infobars
162 226
163 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_ 227 #endif // COMPONENTS_INFOBARS_CORE_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698