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

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

Issue 7796010: Attempt at fixing crash in menus shown from infobars. Here's what the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 gfx::Size(image_size, image_size), ImageLoadingTracker::DONT_CACHE); 97 gfx::Size(image_size, image_size), ImageLoadingTracker::DONT_CACHE);
98 } else { 98 } else {
99 OnImageLoaded(NULL, icon_resource, 0); 99 OnImageLoaded(NULL, icon_resource, 0);
100 } 100 }
101 } 101 }
102 102
103 int ExtensionInfoBar::ContentMinimumWidth() const { 103 int ExtensionInfoBar::ContentMinimumWidth() const {
104 return menu_->GetPreferredSize().width() + kMenuHorizontalMargin; 104 return menu_->GetPreferredSize().width() + kMenuHorizontalMargin;
105 } 105 }
106 106
107 void ExtensionInfoBar::CancelMenu() {
108 menu_runner_.reset();
109 }
110
107 void ExtensionInfoBar::OnImageLoaded(SkBitmap* image, 111 void ExtensionInfoBar::OnImageLoaded(SkBitmap* image,
108 const ExtensionResource& resource, 112 const ExtensionResource& resource,
109 int index) { 113 int index) {
110 if (!GetDelegate()) 114 if (!GetDelegate())
111 return; // The delegate can go away while we asynchronously load images. 115 return; // The delegate can go away while we asynchronously load images.
112 116
113 SkBitmap* icon = image; 117 SkBitmap* icon = image;
114 // Fall back on the default extension icon on failure. 118 // Fall back on the default extension icon on failure.
115 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 119 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
116 if (!image || image->empty()) 120 if (!image || image->empty())
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 views::View::ConvertPointToScreen(menu_, &screen_point); 158 views::View::ConvertPointToScreen(menu_, &screen_point);
155 if (menu_runner_->RunMenuAt(GetWidget(), menu_, 159 if (menu_runner_->RunMenuAt(GetWidget(), menu_,
156 gfx::Rect(screen_point, menu_->size()), views::MenuItemView::TOPLEFT, 160 gfx::Rect(screen_point, menu_->size()), views::MenuItemView::TOPLEFT,
157 views::MenuRunner::HAS_MNEMONICS) == views::MenuRunner::MENU_DELETED) 161 views::MenuRunner::HAS_MNEMONICS) == views::MenuRunner::MENU_DELETED)
158 return; 162 return;
159 } 163 }
160 164
161 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 165 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
162 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; 166 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL;
163 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698