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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add two more const for Windows. Created 6 years, 7 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_infobar_delegate.h" 8 #include "chrome/browser/extensions/extension_infobar_delegate.h"
9 #include "chrome/browser/extensions/extension_view_host.h" 9 #include "chrome/browser/extensions/extension_view_host.h"
10 #include "chrome/browser/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 extensions::ImageLoader* loader = 162 extensions::ImageLoader* loader =
163 extensions::ImageLoader::Get(extension_view_host->browser_context()); 163 extensions::ImageLoader::Get(extension_view_host->browser_context());
164 loader->LoadImageAsync( 164 loader->LoadImageAsync(
165 extension, 165 extension,
166 icon_resource, 166 icon_resource,
167 gfx::Size(image_size, image_size), 167 gfx::Size(image_size, image_size),
168 base::Bind(&ExtensionInfoBar::OnImageLoaded, 168 base::Bind(&ExtensionInfoBar::OnImageLoaded,
169 weak_ptr_factory_.GetWeakPtr())); 169 weak_ptr_factory_.GetWeakPtr()));
170 } 170 }
171 171
172 int ExtensionInfoBar::ContentMinimumWidth() { 172 int ExtensionInfoBar::ContentMinimumWidth() const {
173 return NonExtensionViewWidth() + 173 return NonExtensionViewWidth() +
174 GetDelegate()->extension_view_host()->view()->GetMinimumSize().width(); 174 GetDelegate()->extension_view_host()->view()->GetMinimumSize().width();
Peter Kasting 2014/05/15 18:30:26 If you simply inline "delegate()->AsExtensionInfoB
Elliot Glaysher 2014/05/15 19:56:37 Done.
175 } 175 }
176 176
177 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source, 177 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source,
178 const gfx::Point& point) { 178 const gfx::Point& point) {
179 if (!owner()) 179 if (!owner())
180 return; // We're closing; don't call anything, it might access the owner. 180 return; // We're closing; don't call anything, it might access the owner.
181 const extensions::Extension* extension = 181 const extensions::Extension* extension =
182 GetDelegate()->extension_view_host()->extension(); 182 GetDelegate()->extension_view_host()->extension();
183 DCHECK(icon_as_menu_); 183 DCHECK(icon_as_menu_);
184 184
(...skipping 30 matching lines...) Expand all
215 infobar_icon_->SizeToPreferredSize(); 215 infobar_icon_->SizeToPreferredSize();
216 infobar_icon_->SetVisible(true); 216 infobar_icon_->SetVisible(true);
217 217
218 Layout(); 218 Layout();
219 } 219 }
220 220
221 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 221 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
222 return delegate()->AsExtensionInfoBarDelegate(); 222 return delegate()->AsExtensionInfoBarDelegate();
223 } 223 }
224 224
225 const ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() const {
226 return delegate()->AsExtensionInfoBarDelegate();
227 }
228
225 int ExtensionInfoBar::NonExtensionViewWidth() const { 229 int ExtensionInfoBar::NonExtensionViewWidth() const {
226 return infobar_icon_->width() + kIconHorizontalMargin; 230 return infobar_icon_->width() + kIconHorizontalMargin;
227 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698