OLD | NEW |
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 Loading... |
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 = -1, |
| 68 TEST_INFOBAR = 0, |
| 69 APP_BANNER_INFOBAR_DELEGATE_ANDROID = 1, |
| 70 APP_BANNER_INFOBAR_DELEGATE_DESKTOP = 2, |
| 71 ANDROID_DOWNLOAD_MANAGER_OVERWRITE_INFOBAR_DELEGATE = 3, |
| 72 CHROME_DOWNLOAD_MANAGER_OVERWRITE_INFOBAR_DELEGATE = 4, |
| 73 DOWNLOAD_REQUEST_INFOBAR_DELEGATE_ANDROID = 5, |
| 74 FULLSCREEN_INFOBAR_DELEGATE = 6, |
| 75 HUNG_PLUGIN_INFOBAR_DELEGATE = 7, |
| 76 HUNG_RENDERER_INFOBAR_DELEGATE = 8, |
| 77 MEDIA_STREAM_INFOBAR_DELEGATE_ANDROID = 9, |
| 78 MEDIA_THROTTLE_INFOBAR_DELEGATE = 10, |
| 79 REQUEST_QUOTA_INFOBAR_DELEGATE = 11, |
| 80 DEV_TOOLS_CONFIRM_INFOBAR_DELEGATE = 12, |
| 81 EXTENSION_DEV_TOOLS_INFOBAR_DELEGATE = 13, |
| 82 INCOGNITO_CONNECTABILITY_INFOBAR_DELEGATE = 14, |
| 83 THEME_INSTALLED_INFOBAR_DELEGATE = 15, |
| 84 GEOLOCATION_INFOBAR_DELEGATE_ANDROID = 16, |
| 85 THREE_D_API_INFOBAR_DELEGATE = 17, |
| 86 INSECURE_CONTENT_INFOBAR_DELEGATE = 18, |
| 87 MIDI_PERMISSION_INFOBAR_DELEGATE_ANDROID = 19, |
| 88 PROTECTED_MEDIA_IDENTIFIER_INFOBAR_DELEGATE_ANDROID = 20, |
| 89 NACL_INFOBAR_DELEGATE = 21, |
| 90 DATA_REDUCTION_PROXY_INFOBAR_DELEGATE_ANDROID = 22, |
| 91 NOTIFICATION_PERMISSION_INFOBAR_DELEGATE = 23, |
| 92 AUTO_SIGNIN_FIRST_RUN_INFOBAR_DELEGATE = 24, |
| 93 GENERATED_PASSWORD_SAVED_INFOBAR_DELEGATE_ANDROID = 25, |
| 94 SAVE_PASSWORD_INFOBAR_DELEGATE = 26, |
| 95 PEPPER_BROKER_INFOBAR_DELEGATE = 27, |
| 96 PERMISSION_UPDATE_INFOBAR_DELEGATE = 28, |
| 97 DURABLE_STORAGE_PERMISSION_INFOBAR_DELEGATE_ANDROID = 29, |
| 98 NPAPI_REMOVAL_INFOBAR_DELEGATE = 30, |
| 99 OUTDATED_PLUGIN_INFOBAR_DELEGATE = 31, |
| 100 PLUGIN_METRO_MODE_INFOBAR_DELEGATE = 32, |
| 101 RELOAD_PLUGIN_INFOBAR_DELEGATE = 33, |
| 102 PLUGIN_OBSERVER = 34, |
| 103 SSL_ADD_CERTIFICATE = 35, |
| 104 SSL_ADD_CERTIFICATE_INFOBAR_DELEGATE = 36, |
| 105 POPUP_BLOCKED_INFOBAR_DELEGATE = 37, |
| 106 CHROME_SELECT_FILE_POLICY = 38, |
| 107 KEYSTONE_PROMOTION_INFOBAR_DELEGATE = 39, |
| 108 COLLECTED_COOKIES_INFOBAR_DELEGATE = 40, |
| 109 INSTALLATION_ERROR_INFOBAR_DELEGATE = 41, |
| 110 ALTERNATE_NAV_INFOBAR_DELEGATE = 42, |
| 111 BAD_FLAGS_PROMPT = 43, |
| 112 DEFAULT_BROWSER_INFOBAR_DELEGATE = 44, |
| 113 GOOGLE_API_KEYS_INFOBAR_DELEGATE = 45, |
| 114 OBSOLETE_SYSTEM_INFOBAR_DELEGATE = 46, |
| 115 SESSION_CRASHED_INFOBAR_DELEGATE = 47, |
| 116 WEBSITE_SETTINGS_INFOBAR_DELEGATE = 48, |
| 117 AUTOFILL_CC_INFOBAR_DELEGATE = 49, |
| 118 TRANSLATE_INFOBAR_DELEGATE = 50, |
| 119 IOS_CHROME_SAVE_PASSWORD_INFOBAR_DELEGATE = 51 |
| 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 Loading... |
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_ |
OLD | NEW |