OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 "athena/main/athena_views_delegate.h" | |
6 | |
7 #include "athena/main/athena_frame_view.h" | |
8 #include "athena/screen/public/screen_manager.h" | |
9 #include "ui/views/views_delegate.h" | |
10 | |
11 namespace athena { | |
12 | |
13 namespace { | |
14 | |
15 class AthenaViewsDelegate: public views::ViewsDelegate { | |
16 public: | |
17 AthenaViewsDelegate() { | |
18 } | |
19 | |
20 ~AthenaViewsDelegate() override {} | |
21 | |
22 virtual void OnBeforeWidgetInit( | |
23 views::Widget::InitParams* params, | |
24 views::internal::NativeWidgetDelegate* delegate) override { | |
25 params->context = athena::ScreenManager::Get()->GetContext(); | |
26 } | |
27 | |
28 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( | |
29 views::Widget* widget) override { | |
30 return new AthenaFrameView(widget); | |
31 } | |
32 | |
33 private: | |
34 DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegate); | |
35 }; | |
36 | |
37 } // namespace | |
38 | |
39 void CreateAthenaViewsDelegate() { | |
40 views::ViewsDelegate::views_delegate = new AthenaViewsDelegate; | |
41 } | |
42 | |
43 void ShutdownAthenaViewsDelegate() { | |
44 CHECK(views::ViewsDelegate::views_delegate); | |
45 delete views::ViewsDelegate::views_delegate; | |
46 views::ViewsDelegate::views_delegate = nullptr; | |
47 } | |
48 | |
49 } // namespace athena | |
OLD | NEW |