OLD | NEW |
(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 #ifndef MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ |
| 6 #define MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/mus/public/cpp/window_observer.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" |
| 12 #include "ui/compositor/paint_cache.h" |
| 13 #include "ui/views/window/non_client_view.h" |
| 14 |
| 15 namespace gfx { |
| 16 class Insets; |
| 17 } |
| 18 |
| 19 namespace mus { |
| 20 class Window; |
| 21 } |
| 22 |
| 23 namespace views { |
| 24 class Widget; |
| 25 } |
| 26 |
| 27 namespace mash { |
| 28 namespace wm { |
| 29 |
| 30 class FrameCaptionButtonContainerView; |
| 31 class MoveLoop; |
| 32 |
| 33 class NonClientFrameViewMash : public views::NonClientFrameView, |
| 34 public mus::WindowObserver { |
| 35 public: |
| 36 // Internal class name. |
| 37 static const char kViewClassName[]; |
| 38 |
| 39 NonClientFrameViewMash(views::Widget* frame, mus::Window* window); |
| 40 ~NonClientFrameViewMash() override; |
| 41 |
| 42 static gfx::Insets GetPreferredClientAreaInsets(); |
| 43 |
| 44 // Sets the active and inactive frame colors. Note the inactive frame color |
| 45 // will have some transparency added when the frame is drawn. |
| 46 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); |
| 47 |
| 48 // views::NonClientFrameView: |
| 49 gfx::Rect GetBoundsForClientView() const override; |
| 50 gfx::Rect GetWindowBoundsForClientBounds( |
| 51 const gfx::Rect& client_bounds) const override; |
| 52 int NonClientHitTest(const gfx::Point& point) override; |
| 53 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; |
| 54 void ResetWindowControls() override; |
| 55 void UpdateWindowIcon() override; |
| 56 void UpdateWindowTitle() override; |
| 57 void SizeConstraintsChanged() override; |
| 58 |
| 59 // views::View: |
| 60 void Layout() override; |
| 61 gfx::Size GetPreferredSize() const override; |
| 62 const char* GetClassName() const override; |
| 63 gfx::Size GetMinimumSize() const override; |
| 64 gfx::Size GetMaximumSize() const override; |
| 65 void OnPaint(gfx::Canvas* canvas) override; |
| 66 void PaintChildren(const ui::PaintContext& context) override; |
| 67 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 68 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 69 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 70 void OnMouseCaptureLost() override; |
| 71 |
| 72 // mus::WindowObserver: |
| 73 void OnWindowClientAreaChanged(mus::Window* window, |
| 74 const gfx::Insets& old_client_area) override; |
| 75 void OnWindowDestroyed(mus::Window* window) override; |
| 76 |
| 77 // Get the view of the header. |
| 78 views::View* GetHeaderView(); |
| 79 |
| 80 private: |
| 81 class OverlayView; |
| 82 |
| 83 // Height from top of window to top of client area. |
| 84 int NonClientTopBorderHeight() const; |
| 85 |
| 86 bool StartMoveLoopIfNecessary(const ui::Event& event); |
| 87 void ContinueMove(const ui::Event& event); |
| 88 void StopMove(); |
| 89 |
| 90 // Not owned. |
| 91 views::Widget* frame_; |
| 92 |
| 93 mus::Window* window_; |
| 94 ui::PaintCache paint_cache_; |
| 95 scoped_ptr<MoveLoop> move_loop_; |
| 96 |
| 97 // View which contains the title and window controls. |
| 98 class HeaderView; |
| 99 HeaderView* header_view_; |
| 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(NonClientFrameViewMash); |
| 102 }; |
| 103 |
| 104 } // namespace wm |
| 105 } // namespace mash |
| 106 |
| 107 #endif // MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ |
OLD | NEW |