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

Side by Side Diff: components/mus/example/wm/non_client_frame_view_impl.cc

Issue 1419793006: Makes windowmanager draw non-client area (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add include Created 5 years, 1 month 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/mus/example/wm/non_client_frame_view_impl.h"
6
7 #include "components/mus/public/cpp/window.h"
8 #include "ui/compositor/paint_recorder.h"
9 #include "ui/gfx/canvas.h"
10
11 NonClientFrameViewImpl::NonClientFrameViewImpl(mus::Window* window)
12 : window_(window) {
13 window_->AddObserver(this);
14 }
15
16 NonClientFrameViewImpl::~NonClientFrameViewImpl() {
17 if (window_)
18 window_->RemoveObserver(this);
19 }
20
21 gfx::Rect NonClientFrameViewImpl::GetBoundsForClientView() const {
22 gfx::Rect result(GetLocalBounds());
23 result.Inset(window_->client_area());
24 return result;
25 }
26
27 void NonClientFrameViewImpl::OnPaint(gfx::Canvas* canvas) {
28 canvas->Save();
29 CustomFrameView::OnPaint(canvas);
30 canvas->Restore();
31
32 // The client app draws the client area. Make ours totally transparent so
33 // we only see the client apps client area.
34 canvas->FillRect(GetBoundsForClientView(), SK_ColorBLACK,
35 SkXfermode::kSrc_Mode);
36 }
37
38 void NonClientFrameViewImpl::PaintChildren(const ui::PaintContext& context) {
39 CustomFrameView::PaintChildren(context);
40
41 // The client app draws the client area. Make ours totally transparent so
42 // we only see the client apps client area.
43 ui::PaintRecorder recorder(context, size(), &paint_cache_);
44 recorder.canvas()->FillRect(GetBoundsForClientView(), SK_ColorBLACK,
45 SkXfermode::kSrc_Mode);
46 }
47
48 void NonClientFrameViewImpl::OnWindowClientAreaChanged(
49 mus::Window* window,
50 const gfx::Insets& old_client_area) {
51 Layout();
52 SchedulePaint();
53 }
54
55 void NonClientFrameViewImpl::OnWindowDestroyed(mus::Window* window) {
56 window_->RemoveObserver(this);
57 window_ = nullptr;
58 }
OLDNEW
« no previous file with comments | « components/mus/example/wm/non_client_frame_view_impl.h ('k') | components/mus/example/wm/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698