summaryrefslogtreecommitdiffstats
path: root/athena/main/athena_views_delegate.cc
blob: 4db7ff981148ee2930dc01ad229803101291ce12 (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
// 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.

#include "athena/main/athena_views_delegate.h"

#include "athena/main/athena_frame_view.h"
#include "athena/screen/public/screen_manager.h"
#include "ui/views/views_delegate.h"

namespace athena {

namespace {

class AthenaViewsDelegate: public views::ViewsDelegate {
 public:
  AthenaViewsDelegate() {
  }

  virtual ~AthenaViewsDelegate() {
  }

  virtual void OnBeforeWidgetInit(
      views::Widget::InitParams* params,
      views::internal::NativeWidgetDelegate* delegate) OVERRIDE {
    params->context = athena::ScreenManager::Get()->GetContext();
  }

  virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
      views::Widget* widget) OVERRIDE {
    return new AthenaFrameView(widget);
  }

 private:
  DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegate);
};

}  // namespace

void CreateAthenaViewsDelegate() {
  views::ViewsDelegate::views_delegate = new AthenaViewsDelegate;
}

void ShutdownAthenaViewsDelegate() {
  CHECK(views::ViewsDelegate::views_delegate);
  delete views::ViewsDelegate::views_delegate;
  views::ViewsDelegate::views_delegate = NULL;
}

}  // namespace athena