OLD | NEW |
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 Loading... |
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // This has to be called after Show() to have effect. | 211 // This has to be called after Show() to have effect. |
212 widget->SetOpacity(0xFF * kWindowAlphaValue); | 212 widget->SetOpacity(0xFF * kWindowAlphaValue); |
213 | 213 |
214 #if defined(OS_WIN) | 214 #if defined(OS_WIN) |
215 return gfx::NativeViewId(views::HWNDForWidget(widget)); | 215 return gfx::NativeViewId(views::HWNDForWidget(widget)); |
216 #else | 216 #else |
217 return 0; | 217 return 0; |
218 #endif | 218 #endif |
219 } | 219 } |
220 | 220 |
221 gfx::Size ScreenCaptureNotificationUIViews::GetPreferredSize() { | 221 gfx::Size ScreenCaptureNotificationUIViews::GetPreferredSize() const { |
222 gfx::Size grip_size = gripper_->GetPreferredSize(); | 222 gfx::Size grip_size = gripper_->GetPreferredSize(); |
223 gfx::Size label_size = label_->GetPreferredSize(); | 223 gfx::Size label_size = label_->GetPreferredSize(); |
224 gfx::Size stop_button_size = stop_button_->GetPreferredSize(); | 224 gfx::Size stop_button_size = stop_button_->GetPreferredSize(); |
225 gfx::Size hide_link_size = hide_link_->GetPreferredSize(); | 225 gfx::Size hide_link_size = hide_link_->GetPreferredSize(); |
226 int width = kHorizontalMargin * 3 + grip_size.width() + label_size.width() + | 226 int width = kHorizontalMargin * 3 + grip_size.width() + label_size.width() + |
227 stop_button_size.width() + hide_link_size.width(); | 227 stop_button_size.width() + hide_link_size.width(); |
228 width = std::max(width, kMinimumWidth); | 228 width = std::max(width, kMinimumWidth); |
229 width = std::min(width, kMaximumWidth); | 229 width = std::min(width, kMaximumWidth); |
230 return gfx::Size(width, std::max(label_size.height(), | 230 return gfx::Size(width, std::max(label_size.height(), |
231 std::max(hide_link_size.height(), | 231 std::max(hide_link_size.height(), |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 } // namespace | 333 } // namespace |
334 | 334 |
335 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( | 335 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( |
336 const base::string16& text) { | 336 const base::string16& text) { |
337 return scoped_ptr<ScreenCaptureNotificationUI>( | 337 return scoped_ptr<ScreenCaptureNotificationUI>( |
338 new ScreenCaptureNotificationUIViews(text)); | 338 new ScreenCaptureNotificationUIViews(text)); |
339 } | 339 } |
OLD | NEW |