Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/ui/views/infobars/extension_infobar.cc

Issue 9693022: views: Rename MenuButtonDelegate::RunMenu to something more obvious. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: menu_button_listener.h Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 menu_size.height()); 61 menu_size.height());
62 62
63 GetDelegate()->extension_host()->view()->SetBounds( 63 GetDelegate()->extension_host()->view()->SetBounds(
64 menu_->bounds().right() + kMenuHorizontalMargin, 64 menu_->bounds().right() + kMenuHorizontalMargin,
65 arrow_height(), 65 arrow_height(),
66 std::max(0, EndX() - StartX() - ContentMinimumWidth()), 66 std::max(0, EndX() - StartX() - ContentMinimumWidth()),
67 height() - arrow_height() - 1); 67 height() - arrow_height() - 1);
68 } 68 }
69 69
70 void ExtensionInfoBar::ViewHierarchyChanged(bool is_add, 70 void ExtensionInfoBar::ViewHierarchyChanged(bool is_add,
71 View* parent, 71 views::View* parent,
72 View* child) { 72 views::View* child) {
73 if (!is_add || (child != this) || (menu_ != NULL)) { 73 if (!is_add || (child != this) || (menu_ != NULL)) {
74 InfoBarView::ViewHierarchyChanged(is_add, parent, child); 74 InfoBarView::ViewHierarchyChanged(is_add, parent, child);
75 return; 75 return;
76 } 76 }
77 77
78 menu_ = new views::MenuButton(NULL, string16(), this, false); 78 menu_ = new views::MenuButton(NULL, string16(), this, false);
79 menu_->SetVisible(false); 79 menu_->SetVisible(false);
80 menu_->set_focusable(true); 80 menu_->set_focusable(true);
81 AddChildView(menu_); 81 AddChildView(menu_);
82 82
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 menu_->SetIcon(canvas->ExtractBitmap()); 132 menu_->SetIcon(canvas->ExtractBitmap());
133 menu_->SetVisible(true); 133 menu_->SetVisible(true);
134 134
135 Layout(); 135 Layout();
136 } 136 }
137 137
138 void ExtensionInfoBar::OnDelegateDeleted() { 138 void ExtensionInfoBar::OnDelegateDeleted() {
139 delegate_ = NULL; 139 delegate_ = NULL;
140 } 140 }
141 141
142 void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) { 142 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source,
143 const gfx::Point& point) {
143 if (!owned()) 144 if (!owned())
144 return; // We're closing; don't call anything, it might access the owner. 145 return; // We're closing; don't call anything, it might access the owner.
145 const Extension* extension = GetDelegate()->extension_host()->extension(); 146 const Extension* extension = GetDelegate()->extension_host()->extension();
146 if (!extension->ShowConfigureContextMenus()) 147 if (!extension->ShowConfigureContextMenus())
147 return; 148 return;
148 149
149 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = 150 scoped_refptr<ExtensionContextMenuModel> options_menu_contents =
150 new ExtensionContextMenuModel(extension, browser_, NULL); 151 new ExtensionContextMenuModel(extension, browser_, NULL);
151 DCHECK_EQ(source, menu_); 152 DCHECK_EQ(source, menu_);
152 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); 153 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT);
153 } 154 }
154 155
155 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 156 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
156 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 157 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
157 } 158 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/extension_infobar.h ('k') | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698