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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/browser/ui/views/chrome_views_export.h" | 10 #include "chrome/browser/ui/views/chrome_views_export.h" |
11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
13 #include "ui/base/hit_test.h" | 13 #include "ui/base/hit_test.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/gfx/screen.h" | 16 #include "ui/display/screen.h" |
17 #include "ui/views/bubble/bubble_border.h" | 17 #include "ui/views/bubble/bubble_border.h" |
18 #include "ui/views/bubble/bubble_frame_view.h" | 18 #include "ui/views/bubble/bubble_frame_view.h" |
19 #include "ui/views/controls/button/blue_button.h" | 19 #include "ui/views/controls/button/blue_button.h" |
20 #include "ui/views/controls/image_view.h" | 20 #include "ui/views/controls/image_view.h" |
21 #include "ui/views/controls/link.h" | 21 #include "ui/views/controls/link.h" |
22 #include "ui/views/controls/link_listener.h" | 22 #include "ui/views/controls/link_listener.h" |
23 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
25 #include "ui/views/widget/widget_delegate.h" | 25 #include "ui/views/widget/widget_delegate.h" |
26 #include "ui/wm/core/shadow_types.h" | 26 #include "ui/wm/core/shadow_types.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 params.context = ash::Shell::GetPrimaryRootWindow(); | 188 params.context = ash::Shell::GetPrimaryRootWindow(); |
189 #endif | 189 #endif |
190 | 190 |
191 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); | 191 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); |
192 widget->Init(params); | 192 widget->Init(params); |
193 widget->SetAlwaysOnTop(true); | 193 widget->SetAlwaysOnTop(true); |
194 | 194 |
195 set_background(views::Background::CreateSolidBackground(GetNativeTheme()-> | 195 set_background(views::Background::CreateSolidBackground(GetNativeTheme()-> |
196 GetSystemColor(ui::NativeTheme::kColorId_DialogBackground))); | 196 GetSystemColor(ui::NativeTheme::kColorId_DialogBackground))); |
197 | 197 |
198 gfx::Screen* screen = gfx::Screen::GetScreen(); | 198 display::Screen* screen = display::Screen::GetScreen(); |
199 // TODO(sergeyu): Move the notification to the display being captured when | 199 // TODO(sergeyu): Move the notification to the display being captured when |
200 // per-display screen capture is supported. | 200 // per-display screen capture is supported. |
201 gfx::Rect work_area = screen->GetPrimaryDisplay().work_area(); | 201 gfx::Rect work_area = screen->GetPrimaryDisplay().work_area(); |
202 | 202 |
203 // Place the bar in the center of the bottom of the display. | 203 // Place the bar in the center of the bottom of the display. |
204 gfx::Size size = widget->non_client_view()->GetPreferredSize(); | 204 gfx::Size size = widget->non_client_view()->GetPreferredSize(); |
205 gfx::Rect bounds( | 205 gfx::Rect bounds( |
206 work_area.x() + work_area.width() / 2 - size.width() / 2, | 206 work_area.x() + work_area.width() / 2 - size.width() / 2, |
207 work_area.y() + work_area.height() - size.height(), | 207 work_area.y() + work_area.height() - size.height(), |
208 size.width(), size.height()); | 208 size.width(), size.height()); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 } // namespace | 331 } // namespace |
332 | 332 |
333 std::unique_ptr<ScreenCaptureNotificationUI> | 333 std::unique_ptr<ScreenCaptureNotificationUI> |
334 ScreenCaptureNotificationUI::Create(const base::string16& text) { | 334 ScreenCaptureNotificationUI::Create(const base::string16& text) { |
335 return std::unique_ptr<ScreenCaptureNotificationUI>( | 335 return std::unique_ptr<ScreenCaptureNotificationUI>( |
336 new ScreenCaptureNotificationUIViews(text)); | 336 new ScreenCaptureNotificationUIViews(text)); |
337 } | 337 } |
OLD | NEW |