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

Side by Side Diff: chrome/browser/ui/views/screen_capture_notification_ui_views.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/screen_capture_notification_ui.h" 5 #include "chrome/browser/ui/screen_capture_notification_ui.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/ui/views/chrome_views_export.h" 9 #include "chrome/browser/ui/views/chrome_views_export.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public views::LinkListener { 79 public views::LinkListener {
80 public: 80 public:
81 explicit ScreenCaptureNotificationUIViews(const base::string16& text); 81 explicit ScreenCaptureNotificationUIViews(const base::string16& text);
82 virtual ~ScreenCaptureNotificationUIViews(); 82 virtual ~ScreenCaptureNotificationUIViews();
83 83
84 // ScreenCaptureNotificationUI interface. 84 // ScreenCaptureNotificationUI interface.
85 virtual gfx::NativeViewId OnStarted(const base::Closure& stop_callback) 85 virtual gfx::NativeViewId OnStarted(const base::Closure& stop_callback)
86 OVERRIDE; 86 OVERRIDE;
87 87
88 // views::View overrides. 88 // views::View overrides.
89 virtual gfx::Size GetPreferredSize() OVERRIDE; 89 virtual gfx::Size GetPreferredSize() const OVERRIDE;
90 virtual void Layout() OVERRIDE; 90 virtual void Layout() OVERRIDE;
91 91
92 // views::WidgetDelegateView overrides. 92 // views::WidgetDelegateView overrides.
93 virtual void DeleteDelegate() OVERRIDE; 93 virtual void DeleteDelegate() OVERRIDE;
94 virtual views::View* GetContentsView() OVERRIDE; 94 virtual views::View* GetContentsView() OVERRIDE;
95 virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE; 95 virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
96 virtual views::NonClientFrameView* CreateNonClientFrameView( 96 virtual views::NonClientFrameView* CreateNonClientFrameView(
97 views::Widget* widget) OVERRIDE; 97 views::Widget* widget) OVERRIDE;
98 virtual base::string16 GetWindowTitle() const OVERRIDE; 98 virtual base::string16 GetWindowTitle() const OVERRIDE;
99 virtual bool ShouldShowWindowTitle() const OVERRIDE; 99 virtual bool ShouldShowWindowTitle() const OVERRIDE;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // This has to be called after Show() to have effect. 209 // This has to be called after Show() to have effect.
210 widget->SetOpacity(0xFF * kWindowAlphaValue); 210 widget->SetOpacity(0xFF * kWindowAlphaValue);
211 211
212 #if defined(OS_WIN) 212 #if defined(OS_WIN)
213 return gfx::NativeViewId(views::HWNDForWidget(widget)); 213 return gfx::NativeViewId(views::HWNDForWidget(widget));
214 #else 214 #else
215 return 0; 215 return 0;
216 #endif 216 #endif
217 } 217 }
218 218
219 gfx::Size ScreenCaptureNotificationUIViews::GetPreferredSize() { 219 gfx::Size ScreenCaptureNotificationUIViews::GetPreferredSize() const {
220 gfx::Size grip_size = gripper_->GetPreferredSize(); 220 gfx::Size grip_size = gripper_->GetPreferredSize();
221 gfx::Size label_size = label_->GetPreferredSize(); 221 gfx::Size label_size = label_->GetPreferredSize();
222 gfx::Size stop_button_size = stop_button_->GetPreferredSize(); 222 gfx::Size stop_button_size = stop_button_->GetPreferredSize();
223 gfx::Size hide_link_size = hide_link_->GetPreferredSize(); 223 gfx::Size hide_link_size = hide_link_->GetPreferredSize();
224 int width = kHorizontalMargin * 3 + grip_size.width() + label_size.width() + 224 int width = kHorizontalMargin * 3 + grip_size.width() + label_size.width() +
225 stop_button_size.width() + hide_link_size.width(); 225 stop_button_size.width() + hide_link_size.width();
226 width = std::max(width, kMinimumWidth); 226 width = std::max(width, kMinimumWidth);
227 width = std::min(width, kMaximumWidth); 227 width = std::min(width, kMaximumWidth);
228 return gfx::Size(width, std::max(label_size.height(), 228 return gfx::Size(width, std::max(label_size.height(),
229 std::max(hide_link_size.height(), 229 std::max(hide_link_size.height(),
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 } 329 }
330 330
331 } // namespace 331 } // namespace
332 332
333 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( 333 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create(
334 const base::string16& text) { 334 const base::string16& text) {
335 return scoped_ptr<ScreenCaptureNotificationUI>( 335 return scoped_ptr<ScreenCaptureNotificationUI>(
336 new ScreenCaptureNotificationUIViews(text)); 336 new ScreenCaptureNotificationUIViews(text));
337 } 337 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/user_manager_view.cc ('k') | chrome/browser/ui/views/tab_icon_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698