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

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

Issue 7981045: Make infobars ignore button clicks when closing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 menu_->SetVisible(true); 130 menu_->SetVisible(true);
131 131
132 Layout(); 132 Layout();
133 } 133 }
134 134
135 void ExtensionInfoBar::OnDelegateDeleted() { 135 void ExtensionInfoBar::OnDelegateDeleted() {
136 delegate_ = NULL; 136 delegate_ = NULL;
137 } 137 }
138 138
139 void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) { 139 void ExtensionInfoBar::RunMenu(View* source, const gfx::Point& pt) {
140 if (!owned())
141 return; // We're closing; don't call anything, it might access the owner.
140 const Extension* extension = GetDelegate()->extension_host()->extension(); 142 const Extension* extension = GetDelegate()->extension_host()->extension();
141 if (!extension->ShowConfigureContextMenus()) 143 if (!extension->ShowConfigureContextMenus())
142 return; 144 return;
143 145
144 Browser* browser = BrowserView::GetBrowserViewForNativeWindow( 146 Browser* browser = BrowserView::GetBrowserViewForNativeWindow(
145 platform_util::GetTopLevel(source->GetWidget()->GetNativeView()))-> 147 platform_util::GetTopLevel(source->GetWidget()->GetNativeView()))->
146 browser(); 148 browser();
147 scoped_refptr<ExtensionContextMenuModel> options_menu_contents = 149 scoped_refptr<ExtensionContextMenuModel> options_menu_contents =
148 new ExtensionContextMenuModel(extension, browser, NULL); 150 new ExtensionContextMenuModel(extension, browser, NULL);
149 DCHECK_EQ(source, menu_); 151 DCHECK_EQ(source, menu_);
150 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT); 152 RunMenuAt(options_menu_contents.get(), menu_, views::MenuItemView::TOPLEFT);
151 // TODO(pkasting): this may be deleted after rewrite.
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/confirm_infobar.cc ('k') | chrome/browser/ui/views/infobars/infobar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698