OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 "chrome/browser/ui/views/constrained_window_views.h" | |
6 | |
7 #include "ui/aura/client/aura_constants.h" | |
8 #include "ui/aura/window.h" | |
9 #include "ui/views/widget/native_widget_aura.h" | |
10 | |
11 class NativeConstrainedWindowAura : public NativeConstrainedWindow, | |
12 public views::NativeWidgetAura { | |
13 public: | |
14 explicit NativeConstrainedWindowAura( | |
15 NativeConstrainedWindowDelegate* delegate) | |
16 : views::NativeWidgetAura(delegate->AsNativeWidgetDelegate()), | |
17 delegate_(delegate) { | |
18 GetNativeWindow()->SetProperty(aura::client::kConstrainedWindowKey, true); | |
19 } | |
20 | |
21 virtual ~NativeConstrainedWindowAura() { | |
22 } | |
23 | |
24 private: | |
25 // Overridden from NativeConstrainedWindow: | |
26 virtual views::NativeWidget* AsNativeWidget() OVERRIDE { | |
27 return this; | |
28 } | |
29 | |
30 // Overridden from views::NativeWidgetAura: | |
31 virtual void OnWindowDestroyed() OVERRIDE { | |
32 delegate_->OnNativeConstrainedWindowDestroyed(); | |
33 views::NativeWidgetAura::OnWindowDestroyed(); | |
34 } | |
35 | |
36 NativeConstrainedWindowDelegate* delegate_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(NativeConstrainedWindowAura); | |
39 }; | |
40 | |
41 //////////////////////////////////////////////////////////////////////////////// | |
42 // NativeConstrainedWindow, public: | |
43 | |
44 // static | |
45 NativeConstrainedWindow* NativeConstrainedWindow::CreateNativeConstrainedWindow( | |
46 NativeConstrainedWindowDelegate* delegate) { | |
47 return new NativeConstrainedWindowAura(delegate); | |
48 } | |
OLD | NEW |