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

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: More compile fix for ToT 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 delegate()->AsExtensionInfoBarDelegate()->extension_view_host()->
175 view()->GetMinimumSize().width();
175 } 176 }
176 177
177 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source, 178 void ExtensionInfoBar::OnMenuButtonClicked(views::View* source,
178 const gfx::Point& point) { 179 const gfx::Point& point) {
179 if (!owner()) 180 if (!owner())
180 return; // We're closing; don't call anything, it might access the owner. 181 return; // We're closing; don't call anything, it might access the owner.
181 const extensions::Extension* extension = 182 const extensions::Extension* extension =
182 GetDelegate()->extension_view_host()->extension(); 183 GetDelegate()->extension_view_host()->extension();
183 DCHECK(icon_as_menu_); 184 DCHECK(icon_as_menu_);
184 185
(...skipping 30 matching lines...) Expand all
215 infobar_icon_->SizeToPreferredSize(); 216 infobar_icon_->SizeToPreferredSize();
216 infobar_icon_->SetVisible(true); 217 infobar_icon_->SetVisible(true);
217 218
218 Layout(); 219 Layout();
219 } 220 }
220 221
221 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { 222 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() {
222 return delegate()->AsExtensionInfoBarDelegate(); 223 return delegate()->AsExtensionInfoBarDelegate();
223 } 224 }
224 225
226 const ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() const {
227 return delegate()->AsExtensionInfoBarDelegate();
228 }
229
225 int ExtensionInfoBar::NonExtensionViewWidth() const { 230 int ExtensionInfoBar::NonExtensionViewWidth() const {
226 return infobar_icon_->width() + kIconHorizontalMargin; 231 return infobar_icon_->width() + kIconHorizontalMargin;
227 } 232 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/extension_infobar.h ('k') | chrome/browser/ui/views/infobars/infobar_container_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698