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