Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| 23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
| 24 #include "ui/views/widget/widget_delegate.h" | 24 #include "ui/views/widget/widget_delegate.h" |
| 25 #include "ui/wm/core/shadow_types.h" | 25 #include "ui/wm/core/shadow_types.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 const int kMinimumWidth = 460; | 29 const int kMinimumWidth = 460; |
| 30 const int kMaximumWidth = 1000; | 30 const int kMaximumWidth = 1000; |
| 31 const int kHorizontalMargin = 10; | 31 const int kHorizontalMargin = 10; |
| 32 const int kPadding = 5; | 32 const int kPaddingVertical = 5; |
| 33 const int kPaddingLeft = 10; | 33 const int kPaddingHorizontal = 10; |
| 34 const SkColor kHideLinkColor = SkColorSetRGB(0x55, 0x95, 0xFE); | |
|
msw
2014/03/25 00:01:58
It's wrong to use a hard-coded color over a themed
| |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 // A ClientView that overrides NonClientHitTest() so that the whole window area | 38 // A ClientView that overrides NonClientHitTest() so that the whole window area |
| 38 // acts as a window caption, except a rect specified using SetClientRect(). | 39 // acts as a window caption, except a rect specified using SetClientRect(). |
| 39 // ScreenCaptureNotificationUIViews uses this class to make the notification bar | 40 // ScreenCaptureNotificationUIViews uses this class to make the notification bar |
| 40 // draggable. | 41 // draggable. |
| 41 class NotificationBarClientView : public views::ClientView { | 42 class NotificationBarClientView : public views::ClientView { |
| 42 public: | 43 public: |
| 43 NotificationBarClientView(views::Widget* widget, views::View* view) | 44 NotificationBarClientView(views::Widget* widget, views::View* view) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 base::string16 stop_text = | 144 base::string16 stop_text = |
| 144 l10n_util::GetStringUTF16(IDS_MEDIA_SCREEN_CAPTURE_NOTIFICATION_STOP); | 145 l10n_util::GetStringUTF16(IDS_MEDIA_SCREEN_CAPTURE_NOTIFICATION_STOP); |
| 145 stop_button_ = new views::BlueButton(this, stop_text); | 146 stop_button_ = new views::BlueButton(this, stop_text); |
| 146 AddChildView(stop_button_); | 147 AddChildView(stop_button_); |
| 147 | 148 |
| 148 // TODO(jiayl): IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON is used for the need to | 149 // TODO(jiayl): IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON is used for the need to |
| 149 // merge to M34. Change it to a new IDS_ after the merge. | 150 // merge to M34. Change it to a new IDS_ after the merge. |
| 150 hide_link_ = new views::Link( | 151 hide_link_ = new views::Link( |
| 151 l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)); | 152 l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)); |
| 152 hide_link_->set_listener(this); | 153 hide_link_->set_listener(this); |
| 154 hide_link_->SetUnderline(false); | |
| 155 hide_link_->SetEnabledColor(kHideLinkColor); | |
| 153 AddChildView(hide_link_); | 156 AddChildView(hide_link_); |
| 154 } | 157 } |
| 155 | 158 |
| 156 ScreenCaptureNotificationUIViews::~ScreenCaptureNotificationUIViews() { | 159 ScreenCaptureNotificationUIViews::~ScreenCaptureNotificationUIViews() { |
| 157 stop_callback_.Reset(); | 160 stop_callback_.Reset(); |
| 158 delete GetWidget(); | 161 delete GetWidget(); |
| 159 } | 162 } |
| 160 | 163 |
| 161 void ScreenCaptureNotificationUIViews::OnStarted( | 164 void ScreenCaptureNotificationUIViews::OnStarted( |
| 162 const base::Closure& stop_callback) { | 165 const base::Closure& stop_callback) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 views::Widget* widget) { | 264 views::Widget* widget) { |
| 262 DCHECK(!client_view_); | 265 DCHECK(!client_view_); |
| 263 client_view_ = new NotificationBarClientView(widget, this); | 266 client_view_ = new NotificationBarClientView(widget, this); |
| 264 return client_view_; | 267 return client_view_; |
| 265 } | 268 } |
| 266 | 269 |
| 267 views::NonClientFrameView* | 270 views::NonClientFrameView* |
| 268 ScreenCaptureNotificationUIViews::CreateNonClientFrameView( | 271 ScreenCaptureNotificationUIViews::CreateNonClientFrameView( |
| 269 views::Widget* widget) { | 272 views::Widget* widget) { |
| 270 views::BubbleFrameView* frame = new views::BubbleFrameView( | 273 views::BubbleFrameView* frame = new views::BubbleFrameView( |
| 271 gfx::Insets(kPadding, kPaddingLeft, kPadding, kPadding)); | 274 gfx::Insets(kPaddingVertical, |
| 275 kPaddingHorizontal, | |
| 276 kPaddingVertical, | |
| 277 kPaddingHorizontal)); | |
| 272 SkColor color = widget->GetNativeTheme()->GetSystemColor( | 278 SkColor color = widget->GetNativeTheme()->GetSystemColor( |
| 273 ui::NativeTheme::kColorId_DialogBackground); | 279 ui::NativeTheme::kColorId_DialogBackground); |
| 274 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( | 280 frame->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( |
| 275 new views::BubbleBorder(views::BubbleBorder::NONE, | 281 new views::BubbleBorder(views::BubbleBorder::NONE, |
| 276 views::BubbleBorder::SMALL_SHADOW, | 282 views::BubbleBorder::SMALL_SHADOW, |
| 277 color))); | 283 color))); |
| 278 return frame; | 284 return frame; |
| 279 } | 285 } |
| 280 | 286 |
| 281 base::string16 ScreenCaptureNotificationUIViews::GetWindowTitle() const { | 287 base::string16 ScreenCaptureNotificationUIViews::GetWindowTitle() const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 } | 321 } |
| 316 } | 322 } |
| 317 | 323 |
| 318 } // namespace | 324 } // namespace |
| 319 | 325 |
| 320 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( | 326 scoped_ptr<ScreenCaptureNotificationUI> ScreenCaptureNotificationUI::Create( |
| 321 const base::string16& text) { | 327 const base::string16& text) { |
| 322 return scoped_ptr<ScreenCaptureNotificationUI>( | 328 return scoped_ptr<ScreenCaptureNotificationUI>( |
| 323 new ScreenCaptureNotificationUIViews(text)); | 329 new ScreenCaptureNotificationUIViews(text)); |
| 324 } | 330 } |
| OLD | NEW |