| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // ExtensionDevToolsInfoBarDelegate ------------------------------------------- | 91 // ExtensionDevToolsInfoBarDelegate ------------------------------------------- |
| 92 | 92 |
| 93 class ExtensionDevToolsInfoBarDelegate : public ConfirmInfoBarDelegate { | 93 class ExtensionDevToolsInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 94 public: | 94 public: |
| 95 ExtensionDevToolsInfoBarDelegate(const base::Closure& dismissed_callback, | 95 ExtensionDevToolsInfoBarDelegate(const base::Closure& dismissed_callback, |
| 96 const std::string& client_name); | 96 const std::string& client_name); |
| 97 ~ExtensionDevToolsInfoBarDelegate() override; | 97 ~ExtensionDevToolsInfoBarDelegate() override; |
| 98 | 98 |
| 99 // ConfirmInfoBarDelegate: | 99 // ConfirmInfoBarDelegate: |
| 100 Type GetInfoBarType() const override; | 100 Type GetInfoBarType() const override; |
| 101 std::string GetIdentifier() const override; |
| 101 bool ShouldExpire(const NavigationDetails& details) const override; | 102 bool ShouldExpire(const NavigationDetails& details) const override; |
| 102 void InfoBarDismissed() override; | 103 void InfoBarDismissed() override; |
| 103 base::string16 GetMessageText() const override; | 104 base::string16 GetMessageText() const override; |
| 104 int GetButtons() const override; | 105 int GetButtons() const override; |
| 105 bool Cancel() override; | 106 bool Cancel() override; |
| 106 | 107 |
| 107 std::string client_name_; | 108 std::string client_name_; |
| 108 base::Closure dismissed_callback_; | 109 base::Closure dismissed_callback_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsInfoBarDelegate); | 111 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsInfoBarDelegate); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 ExtensionDevToolsInfoBarDelegate::ExtensionDevToolsInfoBarDelegate( | 114 ExtensionDevToolsInfoBarDelegate::ExtensionDevToolsInfoBarDelegate( |
| 114 const base::Closure& dismissed_callback, | 115 const base::Closure& dismissed_callback, |
| 115 const std::string& client_name) | 116 const std::string& client_name) |
| 116 : ConfirmInfoBarDelegate(), | 117 : ConfirmInfoBarDelegate(), |
| 117 client_name_(client_name), | 118 client_name_(client_name), |
| 118 dismissed_callback_(dismissed_callback) {} | 119 dismissed_callback_(dismissed_callback) {} |
| 119 | 120 |
| 120 ExtensionDevToolsInfoBarDelegate::~ExtensionDevToolsInfoBarDelegate() { | 121 ExtensionDevToolsInfoBarDelegate::~ExtensionDevToolsInfoBarDelegate() { |
| 121 } | 122 } |
| 122 | 123 |
| 123 infobars::InfoBarDelegate::Type | 124 infobars::InfoBarDelegate::Type |
| 124 ExtensionDevToolsInfoBarDelegate::GetInfoBarType() const { | 125 ExtensionDevToolsInfoBarDelegate::GetInfoBarType() const { |
| 125 return WARNING_TYPE; | 126 return WARNING_TYPE; |
| 126 } | 127 } |
| 127 | 128 |
| 129 std::string ExtensionDevToolsInfoBarDelegate::GetIdentifier() const { |
| 130 return "ExtensionDevToolsInfoBarDelegate"; |
| 131 } |
| 132 |
| 128 bool ExtensionDevToolsInfoBarDelegate::ShouldExpire( | 133 bool ExtensionDevToolsInfoBarDelegate::ShouldExpire( |
| 129 const NavigationDetails& details) const { | 134 const NavigationDetails& details) const { |
| 130 return false; | 135 return false; |
| 131 } | 136 } |
| 132 | 137 |
| 133 void ExtensionDevToolsInfoBarDelegate::InfoBarDismissed() { | 138 void ExtensionDevToolsInfoBarDelegate::InfoBarDismissed() { |
| 134 DCHECK(!dismissed_callback_.is_null()); | 139 DCHECK(!dismissed_callback_.is_null()); |
| 135 // Use ResetAndReturn() since running the callback may delete |this|. | 140 // Use ResetAndReturn() since running the callback may delete |this|. |
| 136 base::ResetAndReturn(&dismissed_callback_).Run(); | 141 base::ResetAndReturn(&dismissed_callback_).Run(); |
| 137 } | 142 } |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 const std::vector<DevToolsTargetImpl*>& target_list) { | 721 const std::vector<DevToolsTargetImpl*>& target_list) { |
| 717 scoped_ptr<base::ListValue> result(new base::ListValue()); | 722 scoped_ptr<base::ListValue> result(new base::ListValue()); |
| 718 for (size_t i = 0; i < target_list.size(); ++i) | 723 for (size_t i = 0; i < target_list.size(); ++i) |
| 719 result->Append(SerializeTarget(*target_list[i])); | 724 result->Append(SerializeTarget(*target_list[i])); |
| 720 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 725 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
| 721 SetResult(result.release()); | 726 SetResult(result.release()); |
| 722 SendResponse(true); | 727 SendResponse(true); |
| 723 } | 728 } |
| 724 | 729 |
| 725 } // namespace extensions | 730 } // namespace extensions |
| OLD | NEW |