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

Side by Side Diff: chrome/browser/ui/views/screen_capture_notification_ui_views.cc

Issue 2816193002: Introduce a type of View background that stays in sync with its host (Closed)
Patch Set: tdanderson review + rebase Created 3 years, 8 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
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 "base/macros.h" 7 #include "base/macros.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/ui/views/chrome_views_export.h" 9 #include "chrome/browser/ui/views/chrome_views_export.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // being captured. Make sure it's always the case. Currently we always capture 185 // being captured. Make sure it's always the case. Currently we always capture
186 // the primary monitor. 186 // the primary monitor.
187 if (ash::Shell::HasInstance()) 187 if (ash::Shell::HasInstance())
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::CreateThemedSolidBackground(
196 GetSystemColor(ui::NativeTheme::kColorId_DialogBackground))); 196 this, ui::NativeTheme::kColorId_DialogBackground));
197 197
198 display::Screen* screen = display::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,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 client_view_ = new NotificationBarClientView(widget, this); 272 client_view_ = new NotificationBarClientView(widget, this);
273 return client_view_; 273 return client_view_;
274 } 274 }
275 275
276 views::NonClientFrameView* 276 views::NonClientFrameView*
277 ScreenCaptureNotificationUIViews::CreateNonClientFrameView( 277 ScreenCaptureNotificationUIViews::CreateNonClientFrameView(
278 views::Widget* widget) { 278 views::Widget* widget) {
279 views::BubbleFrameView* frame = new views::BubbleFrameView( 279 views::BubbleFrameView* frame = new views::BubbleFrameView(
280 gfx::Insets(), gfx::Insets(kPaddingVertical, kPaddingHorizontal, 280 gfx::Insets(), gfx::Insets(kPaddingVertical, kPaddingHorizontal,
281 kPaddingVertical, kPaddingHorizontal)); 281 kPaddingVertical, kPaddingHorizontal));
282 SkColor color = widget->GetNativeTheme()->GetSystemColor( 282 SkColor color = widget->GetNativeTheme()->GetSystemColor(
msw 2017/04/19 19:00:54 What updates this precalculated frame color to mat
Evan Stade 2017/04/20 04:44:22 I'll just leave this file alone. I think the corre
msw 2017/04/20 18:21:46 Acknowledged.
283 ui::NativeTheme::kColorId_DialogBackground); 283 ui::NativeTheme::kColorId_DialogBackground);
284 frame->SetBubbleBorder(std::unique_ptr<views::BubbleBorder>( 284 frame->SetBubbleBorder(std::unique_ptr<views::BubbleBorder>(
285 new views::BubbleBorder(views::BubbleBorder::NONE, 285 new views::BubbleBorder(views::BubbleBorder::NONE,
286 views::BubbleBorder::SMALL_SHADOW, color))); 286 views::BubbleBorder::SMALL_SHADOW, color)));
287 return frame; 287 return frame;
288 } 288 }
289 289
290 base::string16 ScreenCaptureNotificationUIViews::GetWindowTitle() const { 290 base::string16 ScreenCaptureNotificationUIViews::GetWindowTitle() const {
291 return text_; 291 return text_;
292 } 292 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 324 }
325 } 325 }
326 326
327 } // namespace 327 } // namespace
328 328
329 std::unique_ptr<ScreenCaptureNotificationUI> 329 std::unique_ptr<ScreenCaptureNotificationUI>
330 ScreenCaptureNotificationUI::Create(const base::string16& text) { 330 ScreenCaptureNotificationUI::Create(const base::string16& text) {
331 return std::unique_ptr<ScreenCaptureNotificationUI>( 331 return std::unique_ptr<ScreenCaptureNotificationUI>(
332 new ScreenCaptureNotificationUIViews(text)); 332 new ScreenCaptureNotificationUIViews(text));
333 } 333 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698