summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/native_constrained_window_aura.cc
blob: 4ea8ea57ab6b6d20ccb2e4b6edbfb51e20ec6dc6 (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
// Copyright (c) 2012 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 "chrome/browser/ui/views/constrained_window_views.h"

#include "ui/views/widget/native_widget_aura.h"

class NativeConstrainedWindowAura : public NativeConstrainedWindow,
                                    public views::NativeWidgetAura {
 public:
  explicit NativeConstrainedWindowAura(
      NativeConstrainedWindowDelegate* delegate)
      : views::NativeWidgetAura(delegate->AsNativeWidgetDelegate()),
        delegate_(delegate) {
  }

  virtual ~NativeConstrainedWindowAura() {
  }

 private:
  // Overridden from NativeConstrainedWindow:
  virtual views::NativeWidget* AsNativeWidget() OVERRIDE {
    return this;
  }

  // Overridden from views::NativeWidgetAura:
  virtual void OnWindowDestroyed() OVERRIDE {
    delegate_->OnNativeConstrainedWindowDestroyed();
    views::NativeWidgetAura::OnWindowDestroyed();
  }

  NativeConstrainedWindowDelegate* delegate_;

  DISALLOW_COPY_AND_ASSIGN(NativeConstrainedWindowAura);
};

////////////////////////////////////////////////////////////////////////////////
// NativeConstrainedWindow, public:

// static
NativeConstrainedWindow* NativeConstrainedWindow::CreateNativeConstrainedWindow(
    NativeConstrainedWindowDelegate* delegate) {
  return new NativeConstrainedWindowAura(delegate);
}