| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" | 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 void set_client_host(ExtensionDevToolsClientHost* client_host) { | 164 void set_client_host(ExtensionDevToolsClientHost* client_host) { |
| 165 client_host_ = client_host; | 165 client_host_ = client_host; |
| 166 } | 166 } |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 explicit ExtensionDevToolsInfoBarDelegate(const std::string& client_name); | 169 explicit ExtensionDevToolsInfoBarDelegate(const std::string& client_name); |
| 170 ~ExtensionDevToolsInfoBarDelegate() override; | 170 ~ExtensionDevToolsInfoBarDelegate() override; |
| 171 | 171 |
| 172 // ConfirmInfoBarDelegate: | 172 // ConfirmInfoBarDelegate: |
| 173 Type GetInfoBarType() const override; |
| 173 void InfoBarDismissed() override; | 174 void InfoBarDismissed() override; |
| 174 Type GetInfoBarType() const override; | |
| 175 bool ShouldExpireInternal(const NavigationDetails& details) const override; | 175 bool ShouldExpireInternal(const NavigationDetails& details) const override; |
| 176 base::string16 GetMessageText() const override; | 176 base::string16 GetMessageText() const override; |
| 177 int GetButtons() const override; | 177 int GetButtons() const override; |
| 178 bool Cancel() override; | 178 bool Cancel() override; |
| 179 | 179 |
| 180 std::string client_name_; | 180 std::string client_name_; |
| 181 ExtensionDevToolsClientHost* client_host_; | 181 ExtensionDevToolsClientHost* client_host_; |
| 182 | 182 |
| 183 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsInfoBarDelegate); | 183 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsInfoBarDelegate); |
| 184 }; | 184 }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 203 ExtensionDevToolsInfoBarDelegate::ExtensionDevToolsInfoBarDelegate( | 203 ExtensionDevToolsInfoBarDelegate::ExtensionDevToolsInfoBarDelegate( |
| 204 const std::string& client_name) | 204 const std::string& client_name) |
| 205 : ConfirmInfoBarDelegate(), | 205 : ConfirmInfoBarDelegate(), |
| 206 client_name_(client_name), | 206 client_name_(client_name), |
| 207 client_host_(NULL) { | 207 client_host_(NULL) { |
| 208 } | 208 } |
| 209 | 209 |
| 210 ExtensionDevToolsInfoBarDelegate::~ExtensionDevToolsInfoBarDelegate() { | 210 ExtensionDevToolsInfoBarDelegate::~ExtensionDevToolsInfoBarDelegate() { |
| 211 } | 211 } |
| 212 | 212 |
| 213 infobars::InfoBarDelegate::Type |
| 214 ExtensionDevToolsInfoBarDelegate::GetInfoBarType() const { |
| 215 return WARNING_TYPE; |
| 216 } |
| 217 |
| 213 void ExtensionDevToolsInfoBarDelegate::InfoBarDismissed() { | 218 void ExtensionDevToolsInfoBarDelegate::InfoBarDismissed() { |
| 214 if (client_host_) | 219 if (client_host_) |
| 215 client_host_->MarkAsDismissed(); | 220 client_host_->MarkAsDismissed(); |
| 216 } | 221 } |
| 217 | 222 |
| 218 infobars::InfoBarDelegate::Type | |
| 219 ExtensionDevToolsInfoBarDelegate::GetInfoBarType() const { | |
| 220 return WARNING_TYPE; | |
| 221 } | |
| 222 | |
| 223 bool ExtensionDevToolsInfoBarDelegate::ShouldExpireInternal( | 223 bool ExtensionDevToolsInfoBarDelegate::ShouldExpireInternal( |
| 224 const NavigationDetails& details) const { | 224 const NavigationDetails& details) const { |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| 227 | 227 |
| 228 base::string16 ExtensionDevToolsInfoBarDelegate::GetMessageText() const { | 228 base::string16 ExtensionDevToolsInfoBarDelegate::GetMessageText() const { |
| 229 return l10n_util::GetStringFUTF16(IDS_DEV_TOOLS_INFOBAR_LABEL, | 229 return l10n_util::GetStringFUTF16(IDS_DEV_TOOLS_INFOBAR_LABEL, |
| 230 base::UTF8ToUTF16(client_name_)); | 230 base::UTF8ToUTF16(client_name_)); |
| 231 } | 231 } |
| 232 | 232 |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 const std::vector<DevToolsTargetImpl*>& target_list) { | 743 const std::vector<DevToolsTargetImpl*>& target_list) { |
| 744 scoped_ptr<base::ListValue> result(new base::ListValue()); | 744 scoped_ptr<base::ListValue> result(new base::ListValue()); |
| 745 for (size_t i = 0; i < target_list.size(); ++i) | 745 for (size_t i = 0; i < target_list.size(); ++i) |
| 746 result->Append(SerializeTarget(*target_list[i])); | 746 result->Append(SerializeTarget(*target_list[i])); |
| 747 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 747 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
| 748 SetResult(result.release()); | 748 SetResult(result.release()); |
| 749 SendResponse(true); | 749 SendResponse(true); |
| 750 } | 750 } |
| 751 | 751 |
| 752 } // namespace extensions | 752 } // namespace extensions |
| OLD | NEW |