| 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 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 typedef base::Callback<void(bool)> InfoBarCallback; | 114 typedef base::Callback<void(bool)> InfoBarCallback; |
| 115 | 115 |
| 116 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | 116 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 117 public: | 117 public: |
| 118 DevToolsConfirmInfoBarDelegate( | 118 DevToolsConfirmInfoBarDelegate( |
| 119 const InfoBarCallback& callback, | 119 const InfoBarCallback& callback, |
| 120 const base::string16& message); | 120 const base::string16& message); |
| 121 ~DevToolsConfirmInfoBarDelegate() override; | 121 ~DevToolsConfirmInfoBarDelegate() override; |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 std::string GetIdentifier() const override; |
| 124 base::string16 GetMessageText() const override; | 125 base::string16 GetMessageText() const override; |
| 125 base::string16 GetButtonLabel(InfoBarButton button) const override; | 126 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 126 bool Accept() override; | 127 bool Accept() override; |
| 127 bool Cancel() override; | 128 bool Cancel() override; |
| 128 | 129 |
| 129 InfoBarCallback callback_; | 130 InfoBarCallback callback_; |
| 130 const base::string16 message_; | 131 const base::string16 message_; |
| 131 | 132 |
| 132 DISALLOW_COPY_AND_ASSIGN(DevToolsConfirmInfoBarDelegate); | 133 DISALLOW_COPY_AND_ASSIGN(DevToolsConfirmInfoBarDelegate); |
| 133 }; | 134 }; |
| 134 | 135 |
| 135 DevToolsConfirmInfoBarDelegate::DevToolsConfirmInfoBarDelegate( | 136 DevToolsConfirmInfoBarDelegate::DevToolsConfirmInfoBarDelegate( |
| 136 const InfoBarCallback& callback, | 137 const InfoBarCallback& callback, |
| 137 const base::string16& message) | 138 const base::string16& message) |
| 138 : ConfirmInfoBarDelegate(), | 139 : ConfirmInfoBarDelegate(), |
| 139 callback_(callback), | 140 callback_(callback), |
| 140 message_(message) { | 141 message_(message) { |
| 141 } | 142 } |
| 142 | 143 |
| 143 DevToolsConfirmInfoBarDelegate::~DevToolsConfirmInfoBarDelegate() { | 144 DevToolsConfirmInfoBarDelegate::~DevToolsConfirmInfoBarDelegate() { |
| 144 if (!callback_.is_null()) | 145 if (!callback_.is_null()) |
| 145 callback_.Run(false); | 146 callback_.Run(false); |
| 146 } | 147 } |
| 147 | 148 |
| 149 std::string DevToolsConfirmInfoBarDelegate::GetIdentifier() const { |
| 150 return "DevToolsConfirmInfoBarDelegate"; |
| 151 } |
| 152 |
| 148 base::string16 DevToolsConfirmInfoBarDelegate::GetMessageText() const { | 153 base::string16 DevToolsConfirmInfoBarDelegate::GetMessageText() const { |
| 149 return message_; | 154 return message_; |
| 150 } | 155 } |
| 151 | 156 |
| 152 base::string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel( | 157 base::string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel( |
| 153 InfoBarButton button) const { | 158 InfoBarButton button) const { |
| 154 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 159 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 155 IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON); | 160 IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON); |
| 156 } | 161 } |
| 157 | 162 |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 return; | 1211 return; |
| 1207 frontend_loaded_ = true; | 1212 frontend_loaded_ = true; |
| 1208 | 1213 |
| 1209 // Call delegate first - it seeds importants bit of information. | 1214 // Call delegate first - it seeds importants bit of information. |
| 1210 delegate_->OnLoadCompleted(); | 1215 delegate_->OnLoadCompleted(); |
| 1211 | 1216 |
| 1212 AddDevToolsExtensionsToClient(); | 1217 AddDevToolsExtensionsToClient(); |
| 1213 if (g_web_socket_api_channel) | 1218 if (g_web_socket_api_channel) |
| 1214 g_web_socket_api_channel->AttachedToBindings(this); | 1219 g_web_socket_api_channel->AttachedToBindings(this); |
| 1215 } | 1220 } |
| OLD | NEW |