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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit again 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 #include "chrome/browser/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 typedef base::Callback<void(bool)> InfoBarCallback; 119 typedef base::Callback<void(bool)> InfoBarCallback;
120 120
121 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { 121 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
122 public: 122 public:
123 DevToolsConfirmInfoBarDelegate( 123 DevToolsConfirmInfoBarDelegate(
124 const InfoBarCallback& callback, 124 const InfoBarCallback& callback,
125 const base::string16& message); 125 const base::string16& message);
126 ~DevToolsConfirmInfoBarDelegate() override; 126 ~DevToolsConfirmInfoBarDelegate() override;
127 127
128 private: 128 private:
129 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
129 base::string16 GetMessageText() const override; 130 base::string16 GetMessageText() const override;
130 base::string16 GetButtonLabel(InfoBarButton button) const override; 131 base::string16 GetButtonLabel(InfoBarButton button) const override;
131 bool Accept() override; 132 bool Accept() override;
132 bool Cancel() override; 133 bool Cancel() override;
133 134
134 InfoBarCallback callback_; 135 InfoBarCallback callback_;
135 const base::string16 message_; 136 const base::string16 message_;
136 137
137 DISALLOW_COPY_AND_ASSIGN(DevToolsConfirmInfoBarDelegate); 138 DISALLOW_COPY_AND_ASSIGN(DevToolsConfirmInfoBarDelegate);
138 }; 139 };
139 140
140 DevToolsConfirmInfoBarDelegate::DevToolsConfirmInfoBarDelegate( 141 DevToolsConfirmInfoBarDelegate::DevToolsConfirmInfoBarDelegate(
141 const InfoBarCallback& callback, 142 const InfoBarCallback& callback,
142 const base::string16& message) 143 const base::string16& message)
143 : ConfirmInfoBarDelegate(), 144 : ConfirmInfoBarDelegate(),
144 callback_(callback), 145 callback_(callback),
145 message_(message) { 146 message_(message) {
146 } 147 }
147 148
148 DevToolsConfirmInfoBarDelegate::~DevToolsConfirmInfoBarDelegate() { 149 DevToolsConfirmInfoBarDelegate::~DevToolsConfirmInfoBarDelegate() {
149 if (!callback_.is_null()) 150 if (!callback_.is_null())
150 callback_.Run(false); 151 callback_.Run(false);
151 } 152 }
152 153
154 infobars::InfoBarDelegate::InfoBarIdentifier
155 DevToolsConfirmInfoBarDelegate::GetIdentifier() const {
156 return DEV_TOOLS_CONFIRM_INFOBAR_DELEGATE;
157 }
158
153 base::string16 DevToolsConfirmInfoBarDelegate::GetMessageText() const { 159 base::string16 DevToolsConfirmInfoBarDelegate::GetMessageText() const {
154 return message_; 160 return message_;
155 } 161 }
156 162
157 base::string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel( 163 base::string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel(
158 InfoBarButton button) const { 164 InfoBarButton button) const {
159 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 165 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
160 IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON); 166 IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON);
161 } 167 }
162 168
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 return; 1217 return;
1212 frontend_loaded_ = true; 1218 frontend_loaded_ = true;
1213 1219
1214 // Call delegate first - it seeds importants bit of information. 1220 // Call delegate first - it seeds importants bit of information.
1215 delegate_->OnLoadCompleted(); 1221 delegate_->OnLoadCompleted();
1216 1222
1217 AddDevToolsExtensionsToClient(); 1223 AddDevToolsExtensionsToClient();
1218 if (g_web_socket_api_channel) 1224 if (g_web_socket_api_channel)
1219 g_web_socket_api_channel->AttachedToBindings(this); 1225 g_web_socket_api_channel->AttachedToBindings(this);
1220 } 1226 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_quota_permission_context.cc ('k') | chrome/browser/devtools/global_confirm_info_bar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698