OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "athena/main/athena_views_delegate.h" | 5 #include "athena/main/athena_views_delegate.h" |
6 | 6 |
7 #include "athena/main/athena_frame_view.h" | 7 #include "athena/main/athena_frame_view.h" |
8 #include "athena/screen/public/screen_manager.h" | 8 #include "athena/screen/public/screen_manager.h" |
9 #include "ui/views/views_delegate.h" | |
9 | 10 |
10 namespace athena { | 11 namespace athena { |
11 | 12 |
12 void AthenaViewsDelegate::OnBeforeWidgetInit( | 13 namespace { |
13 views::Widget::InitParams* params, | 14 |
14 views::internal::NativeWidgetDelegate* delegate) { | 15 class AthenaViewsDelegateImpl : public AthenaViewsDelegate, |
oshima
2014/09/23 20:35:53
and you don't have to extend AthenaViewsDelegate.
pkotwicz
2014/09/23 20:44:38
Oshima, do you think that it is worth AthenaViewsD
oshima
2014/09/23 20:49:56
SGTM
| |
15 params->context = athena::ScreenManager::Get()->GetContext(); | 16 public views::ViewsDelegate { |
17 public: | |
18 AthenaViewsDelegateImpl() { | |
19 } | |
20 | |
21 virtual ~AthenaViewsDelegateImpl() { | |
22 } | |
23 | |
24 virtual void OnBeforeWidgetInit( | |
25 views::Widget::InitParams* params, | |
26 views::internal::NativeWidgetDelegate* delegate) OVERRIDE { | |
27 params->context = athena::ScreenManager::Get()->GetContext(); | |
28 } | |
29 | |
30 virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( | |
31 views::Widget* widget) OVERRIDE { | |
32 return new AthenaFrameView(widget); | |
33 } | |
34 | |
35 private: | |
36 DISALLOW_COPY_AND_ASSIGN(AthenaViewsDelegateImpl); | |
37 }; | |
38 | |
39 } // namespace | |
40 | |
41 // static | |
42 views::ViewsDelegate* AthenaViewsDelegate::Create() { | |
43 views::ViewsDelegate::views_delegate = new AthenaViewsDelegateImpl; | |
44 return views::ViewsDelegate::views_delegate; | |
16 } | 45 } |
17 | 46 |
18 views::NonClientFrameView* AthenaViewsDelegate::CreateDefaultNonClientFrameView( | 47 // static |
19 views::Widget* widget) { | 48 void AthenaViewsDelegate::Shutdown() { |
20 return new AthenaFrameView(widget); | 49 CHECK(views::ViewsDelegate::views_delegate); |
50 delete views::ViewsDelegate::views_delegate; | |
51 views::ViewsDelegate::views_delegate = NULL; | |
21 } | 52 } |
22 | 53 |
23 } // namespace athena | 54 } // namespace athena |
OLD | NEW |