OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void ExtensionInfoBar::ViewHierarchyChanged(bool is_add, | 69 void ExtensionInfoBar::ViewHierarchyChanged(bool is_add, |
70 View* parent, | 70 View* parent, |
71 View* child) { | 71 View* child) { |
72 if (!is_add || (child != this) || (menu_ != NULL)) { | 72 if (!is_add || (child != this) || (menu_ != NULL)) { |
73 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 73 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
74 return; | 74 return; |
75 } | 75 } |
76 | 76 |
77 menu_ = new views::MenuButton(NULL, string16(), this, false); | 77 menu_ = new views::MenuButton(NULL, string16(), this, false); |
78 menu_->SetVisible(false); | 78 menu_->SetVisible(false); |
| 79 menu_->set_focusable(true); |
79 AddChildView(menu_); | 80 AddChildView(menu_); |
80 | 81 |
81 ExtensionHost* extension_host = GetDelegate()->extension_host(); | 82 ExtensionHost* extension_host = GetDelegate()->extension_host(); |
82 AddChildView(extension_host->view()); | 83 AddChildView(extension_host->view()); |
83 | 84 |
84 // This must happen after adding all other children so InfoBarView can ensure | 85 // This must happen after adding all other children so InfoBarView can ensure |
85 // the close button is the last child. | 86 // the close button is the last child. |
86 InfoBarView::ViewHierarchyChanged(is_add, parent, child); | 87 InfoBarView::ViewHierarchyChanged(is_add, parent, child); |
87 | 88 |
88 // This must happen after adding all children because it can trigger layout, | 89 // This must happen after adding all children because it can trigger layout, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 148 |
148 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = | 149 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = |
149 new ExtensionContextMenuModel(extension, browser_, NULL); | 150 new ExtensionContextMenuModel(extension, browser_, NULL); |
150 DCHECK_EQ(source, menu_); | 151 DCHECK_EQ(source, menu_); |
151 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); | 152 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); |
152 } | 153 } |
153 | 154 |
154 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 155 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
155 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; | 156 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; |
156 } | 157 } |
OLD | NEW |