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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
28 #include "ui/views/win/hwnd_util.h" | 28 #include "ui/views/win/hwnd_util.h" |
29 #endif | 29 #endif |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 const int kMinimumWidth = 460; | 33 const int kMinimumWidth = 460; |
34 const int kMaximumWidth = 1000; | 34 const int kMaximumWidth = 1000; |
35 const int kHorizontalMargin = 10; | 35 const int kHorizontalMargin = 10; |
36 const int kPadding = 5; | |
37 const int kPaddingLeft = 10; | |
38 const float kWindowAlphaValue = 0.85f; | 36 const float kWindowAlphaValue = 0.85f; |
| 37 const int kPaddingVertical = 5; |
| 38 const int kPaddingHorizontal = 10; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 // A ClientView that overrides NonClientHitTest() so that the whole window area | 42 // A ClientView that overrides NonClientHitTest() so that the whole window area |
43 // acts as a window caption, except a rect specified using SetClientRect(). | 43 // acts as a window caption, except a rect specified using SetClientRect(). |
44 // ScreenCaptureNotificationUIViews uses this class to make the notification bar | 44 // ScreenCaptureNotificationUIViews uses this class to make the notification bar |
45 // draggable. | 45 // draggable. |
46 class NotificationBarClientView : public views::ClientView { | 46 class NotificationBarClientView : public views::ClientView { |
47 public: | 47 public: |
48 NotificationBarClientView(views::Widget* widget, views::View* view) | 48 NotificationBarClientView(views::Widget* widget, views::View* view) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 base::string16 stop_text = | 149 base::string16 stop_text = |
150 l10n_util::GetStringUTF16(IDS_MEDIA_SCREEN_CAPTURE_NOTIFICATION_STOP); | 150 l10n_util::GetStringUTF16(IDS_MEDIA_SCREEN_CAPTURE_NOTIFICATION_STOP); |
151 stop_button_ = new views::BlueButton(this, stop_text); | 151 stop_button_ = new views::BlueButton(this, stop_text); |
152 AddChildView(stop_button_); | 152 AddChildView(stop_button_); |
153 | 153 |
154 // TODO(jiayl): IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON is used for the need to | 154 // TODO(jiayl): IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON is used for the need to |
155 // merge to M34. Change it to a new IDS_ after the merge. | 155 // merge to M34. Change it to a new IDS_ after the merge. |
156 hide_link_ = new views::Link( | 156 hide_link_ = new views::Link( |
157 l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)); | 157 l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)); |
158 hide_link_->set_listener(this); | 158 hide_link_->set_listener(this); |
| 159 hide_link_->SetUnderline(false); |
159 AddChildView(hide_link_); | 160 AddChildView(hide_link_); |
160 } | 161 } |
161 | 162 |
162 ScreenCaptureNotificationUIViews::~ScreenCaptureNotificationUIViews() { | 163 ScreenCaptureNotificationUIViews::~ScreenCaptureNotificationUIViews() { |
163 stop_callback_.Reset(); | 164 stop_callback_.Reset(); |
164 delete GetWidget(); | 165 delete GetWidget(); |
165 } | 166 } |
166 | 167 |
167 gfx::NativeViewId ScreenCaptureNotificationUIViews::OnStarted( | 168 gfx::NativeViewId ScreenCaptureNotificationUIViews::OnStarted( |
168 const base::Closure& stop_callback) { | 169 const base::Closure& stop_callback) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 views::Widget* widget) { | 274 views::Widget* widget) { |
274 DCHECK(!client_view_); | 275 DCHECK(!client_view_); |
275 client_view_ = new NotificationBarClientView(widget, this); | 276 client_view_ = new NotificationBarClientView(widget, this); |
276 return client_view_; | 277 return client_view_; |
277 } | 278 } |
278 | 279 |
279 views::NonClientFrameView* | 280 views::NonClientFrameView* |
280 ScreenCaptureNotificationUIViews::CreateNonClientFrameView( | 281 ScreenCaptureNotificationUIViews::CreateNonClientFrameView( |
281 views::Widget* widget) { | 282 views::Widget* widget) { |
282 views::BubbleFrameView* frame = new views::BubbleFrameView( | 283 views::BubbleFrameView* frame = new views::BubbleFrameView( |
283 gfx::Insets(kPadding, kPaddingLeft, kPadding, kPadding)); | 284 gfx::Insets(kPaddingVertical, |
| 285 kPaddingHorizontal, |
| 286 kPaddingVertical, |
| 287 kPaddingHorizontal)); |
284 SkColor color = widget->GetNativeTheme()->GetSystemColor( | 288 SkColor color = widget->GetNativeTheme()->GetSystemColor( |
285 ui::NativeTheme::kColorId_DialogBackground); | 289 ui::NativeTheme::kColorId_DialogBackground); |
286 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( | 290 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( |
287 new views::BubbleBorder(views::BubbleBorder::NONE, | 291 new views::BubbleBorder(views::BubbleBorder::NONE, |
288 views::BubbleBorder::SMALL_SHADOW, | 292 views::BubbleBorder::SMALL_SHADOW, |
289 color))); | 293 color))); |
290 return frame; | 294 return frame; |
291 } | 295 } |
292 | 296 |
293 base::string16 ScreenCaptureNotificationUIViews::GetWindowTitle() const { | 297 base::string16 ScreenCaptureNotificationUIViews::GetWindowTitle() const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 331 } |
328 } | 332 } |
329 | 333 |
330 } // namespace | 334 } // namespace |
331 | 335 |
332 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( | 336 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( |
333 const base::string16& text) { | 337 const base::string16& text) { |
334 return scoped_ptr<ScreenCaptureNotificationUI>( | 338 return scoped_ptr<ScreenCaptureNotificationUI>( |
335 new ScreenCaptureNotificationUIViews(text)); | 339 new ScreenCaptureNotificationUIViews(text)); |
336 } | 340 } |
OLD | NEW |