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 #include "chrome/browser/ui/views/infobars/extension_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_context_menu_model.h" | 7 #include "chrome/browser/extensions/extension_context_menu_model.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
10 #include "chrome/browser/extensions/image_loader.h" | 10 #include "chrome/browser/extensions/image_loader.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return infobar_icon_->GetPreferredSize().width() + kIconHorizontalMargin; | 163 return infobar_icon_->GetPreferredSize().width() + kIconHorizontalMargin; |
164 | 164 |
165 } | 165 } |
166 | 166 |
167 void ExtensionInfoBar::OnDelegateDeleted() { | 167 void ExtensionInfoBar::OnDelegateDeleted() { |
168 delegate_ = NULL; | 168 delegate_ = NULL; |
169 } | 169 } |
170 | 170 |
171 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source, | 171 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source, |
172 const gfx::Point& point) { | 172 const gfx::Point& point) { |
173 if (!owned()) | 173 if (!owner()) |
174 return; // We're closing; don't call anything, it might access the owner. | 174 return; // We're closing; don't call anything, it might access the owner. |
175 const extensions::Extension* extension = GetDelegate()->extension_host()-> | 175 const extensions::Extension* extension = GetDelegate()->extension_host()-> |
176 extension(); | 176 extension(); |
177 DCHECK(icon_as_menu_); | 177 DCHECK(icon_as_menu_); |
178 | 178 |
179 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = | 179 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = |
180 new ExtensionContextMenuModel(extension, browser_); | 180 new ExtensionContextMenuModel(extension, browser_); |
181 DCHECK_EQ(icon_as_menu_, source); | 181 DCHECK_EQ(icon_as_menu_, source); |
182 RunMenuAt(options_menu_contents.get(), | 182 RunMenuAt(options_menu_contents.get(), |
183 icon_as_menu_, | 183 icon_as_menu_, |
(...skipping 24 matching lines...) Expand all Loading... |
208 } | 208 } |
209 | 209 |
210 infobar_icon_->SetVisible(true); | 210 infobar_icon_->SetVisible(true); |
211 | 211 |
212 Layout(); | 212 Layout(); |
213 } | 213 } |
214 | 214 |
215 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 215 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
216 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; | 216 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; |
217 } | 217 } |
OLD | NEW |