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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (!is_add || (child != this) || (menu_ != NULL)) { | 111 if (!is_add || (child != this) || (menu_ != NULL)) { |
112 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 112 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 menu_ = new views::MenuButton(NULL, string16(), this, false); | 116 menu_ = new views::MenuButton(NULL, string16(), this, false); |
117 menu_->SetVisible(false); | 117 menu_->SetVisible(false); |
118 menu_->set_focusable(true); | 118 menu_->set_focusable(true); |
119 AddChildView(menu_); | 119 AddChildView(menu_); |
120 | 120 |
121 ExtensionHost* extension_host = GetDelegate()->extension_host(); | 121 extensions::ExtensionHost* extension_host = GetDelegate()->extension_host(); |
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(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = | 181 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = |
182 new ExtensionContextMenuModel(extension, browser_); | 182 new ExtensionContextMenuModel(extension, browser_); |
183 DCHECK_EQ(menu_, source); | 183 DCHECK_EQ(menu_, source); |
184 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); | 184 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); |
185 } | 185 } |
186 | 186 |
187 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 187 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
188 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; | 188 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; |
189 } | 189 } |
OLD | NEW |