summaryrefslogtreecommitdiffstats
path: root/athena/activity/activity_frame_view.h
blob: 23f559c800894489b42e9896c0d38ad77a54b09d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ATHENA_ACTIVITY_ACTIVITY_FRAME_VIEW_H_
#define ATHENA_ACTIVITY_ACTIVITY_FRAME_VIEW_H_

#include "athena/wm/public/window_manager_observer.h"
#include "ui/gfx/insets.h"
#include "ui/views/window/non_client_view.h"

namespace views {
class ImageView;
class Label;
class Widget;
}

namespace athena {

class ActivityViewModel;

// A NonClientFrameView used for activity.
class ActivityFrameView : public views::NonClientFrameView,
                          public WindowManagerObserver {
 public:
  // The frame class name.
  static const char kViewClassName[];

  ActivityFrameView(views::Widget* frame, ActivityViewModel* view_model);
  virtual ~ActivityFrameView();

  // views::NonClientFrameView:
  virtual gfx::Rect GetBoundsForClientView() const override;
  virtual gfx::Rect GetWindowBoundsForClientBounds(
      const gfx::Rect& client_bounds) const override;
  virtual int NonClientHitTest(const gfx::Point& point) override;
  virtual void GetWindowMask(const gfx::Size& size,
                             gfx::Path* window_mask) override;
  virtual void ResetWindowControls() override;
  virtual void UpdateWindowIcon() override;
  virtual void UpdateWindowTitle() override;
  virtual void SizeConstraintsChanged() override;

  // views::View:
  virtual gfx::Size GetPreferredSize() const override;
  virtual const char* GetClassName() const override;
  virtual void Layout() override;
  virtual void OnPaintBackground(gfx::Canvas* canvas) override;

 private:
  // WindowManagerObserver:
  virtual void OnOverviewModeEnter() override;
  virtual void OnOverviewModeExit() override;
  virtual void OnSplitViewModeEnter() override;
  virtual void OnSplitViewModeExit() override;

  gfx::Insets NonClientBorderInsets() const;
  int NonClientBorderThickness() const;
  int NonClientTopBorderHeight() const;

  // Not owned.
  views::Widget* frame_;
  ActivityViewModel* view_model_;
  views::Label* title_;
  views::ImageView* icon_;

  // Whether overview mode is active.
  bool in_overview_;

  DISALLOW_COPY_AND_ASSIGN(ActivityFrameView);
};

}  // namespace athena

#endif  // ATHENA_ACTIVITY_ACTIVITY_FRAME_VIEW_H_