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

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: move wm nonclientframeview to wm 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 LOG(WARNING) << "OnPaint " << window_->client_area().top();
Ben Goodger (Google) 2015/11/04 23:03:21 nit: remove
sky 2015/11/05 00:18:01 Done.
33
34 // The client app draws the client area. Make ours totally transparent so
35 // we only see the client apps client area.
36 canvas->FillRect(GetBoundsForClientView(), SK_ColorBLACK,
37 SkXfermode::kSrc_Mode);
38 }
39
40 void NonClientFrameViewImpl::PaintChildren(const ui::PaintContext& context) {
41 CustomFrameView::PaintChildren(context);
42
43 // The client app draws the client area. Make ours totally transparent so
44 // we only see the client apps client area.
45 ui::PaintRecorder recorder(context, size(), &paint_cache_);
46 recorder.canvas()->FillRect(GetBoundsForClientView(), SK_ColorBLACK,
47 SkXfermode::kSrc_Mode);
48 }
49
50 void NonClientFrameViewImpl::OnWindowClientAreaChanged(
51 mus::Window* window,
52 const gfx::Insets& old_client_area) {
53 LOG(WARNING) << "OnWindowClientAreaChanged " << window_->client_area().top();
Ben Goodger (Google) 2015/11/04 23:03:21 etc
sky 2015/11/05 00:18:02 Done.
54 Layout();
55 SchedulePaint();
56 }
57
58 void NonClientFrameViewImpl::OnWindowDestroyed(mus::Window* window) {
59 window_->RemoveObserver(this);
60 window_ = nullptr;
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698