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/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 AddChildView(extension_host->view()); | 122 AddChildView(extension_host->view()); |
123 | 123 |
124 // This must happen after adding all other children so InfoBarView can ensure | 124 // This must happen after adding all other children so InfoBarView can ensure |
125 // the close button is the last child. | 125 // the close button is the last child. |
126 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 126 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
127 | 127 |
128 // This must happen after adding all children because it can trigger layout, | 128 // This must happen after adding all children because it can trigger layout, |
129 // which assumes that particular children (e.g. the close button) have already | 129 // which assumes that particular children (e.g. the close button) have already |
130 // been added. | 130 // been added. |
131 const extensions::Extension* extension = extension_host->extension(); | 131 const extensions::Extension* extension = extension_host->extension(); |
132 ExtensionIconSet::Icons image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; | 132 ExtensionIconSet::ExtensionIcons image_size = |
| 133 ExtensionIconSet::EXTENSION_ICON_BITTY; |
133 ExtensionResource icon_resource = extension->GetIconResource( | 134 ExtensionResource icon_resource = extension->GetIconResource( |
134 image_size, ExtensionIconSet::MATCH_EXACTLY); | 135 image_size, ExtensionIconSet::MATCH_EXACTLY); |
135 tracker_.LoadImage(extension, icon_resource, | 136 tracker_.LoadImage(extension, icon_resource, |
136 gfx::Size(image_size, image_size), ImageLoadingTracker::DONT_CACHE); | 137 gfx::Size(image_size, image_size), ImageLoadingTracker::DONT_CACHE); |
137 } | 138 } |
138 | 139 |
139 int ExtensionInfoBar::ContentMinimumWidth() const { | 140 int ExtensionInfoBar::ContentMinimumWidth() const { |
140 return menu_->GetPreferredSize().width() + kMenuHorizontalMargin; | 141 return menu_->GetPreferredSize().width() + kMenuHorizontalMargin; |
141 } | 142 } |
142 | 143 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = | 182 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = |
182 new ExtensionContextMenuModel(extension, browser_); | 183 new ExtensionContextMenuModel(extension, browser_); |
183 DCHECK_EQ(menu_, source); | 184 DCHECK_EQ(menu_, source); |
184 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); | 185 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); |
185 } | 186 } |
186 | 187 |
187 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 188 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
188 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; | 189 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; |
189 } | 190 } |
OLD | NEW |