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 #ifndef WM_FOREIGN_WINDOW_H_ | |
6 #define WM_FOREIGN_WINDOW_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "ui/views/widget/widget_delegate.h" | |
10 #include "wm/host/foreign_window_host_delegate.h" | |
11 | |
12 namespace views { | |
13 class ClientView; | |
14 } | |
15 | |
16 namespace wm { | |
17 class ForeignWindowClientView; | |
18 class ForeignWindowHost; | |
19 | |
20 class ForeignWindow : public base::RefCounted<ForeignWindow>, | |
21 public ForeignWindowHostDelegate, | |
22 public views::WidgetDelegate { | |
23 public: | |
24 enum DisplayState { | |
25 DISPLAY_NORMAL, | |
26 DISPLAY_ICONIC, | |
27 DISPLAY_WITHDRAWN | |
28 }; | |
29 struct CreateParams { | |
30 CreateParams(gfx::PluginWindowHandle window_handle, | |
danakj
2013/02/21 01:33:15
let's make a new constant instead of reusing the p
reveman
2013/02/22 01:26:44
I made this change but decided to revert it. Forei
| |
31 const gfx::Size& preferred_size); | |
danakj
2013/02/21 01:33:15
by value
reveman
2013/02/22 01:26:44
what's the rational for this?
danakj
2013/02/22 01:48:08
Classes that consist entirely of <= 4 ints, or <=
reveman
2013/02/22 06:53:01
Done.
| |
32 | |
33 gfx::PluginWindowHandle window_handle; | |
34 gfx::Size preferred_size; | |
35 }; | |
36 explicit ForeignWindow(const CreateParams& params); | |
37 | |
38 // Retrieves the ForeignWindow implementation associated with the | |
39 // given NativeView, or NULL if the supplied handle has no associated | |
40 // ForeignWindow. | |
41 static ForeignWindow* GetForeignWindowForNativeView( | |
42 gfx::NativeView native_view); | |
43 | |
44 // Overridden from wm::ForeignWindowHostDelegate. | |
45 virtual void OnWindowContentsChanged() OVERRIDE; | |
46 virtual ForeignWindow* AsForeignWindow() OVERRIDE; | |
danakj
2013/02/21 01:33:15
Seems like this is a backdoor to more ForeignWindo
reveman
2013/02/22 01:26:44
Removed it as not used.
| |
47 | |
48 // Overridden from views::WidgetDelegate: | |
49 virtual views::Widget* GetWidget() OVERRIDE; | |
50 virtual const views::Widget* GetWidget() const OVERRIDE; | |
51 virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE; | |
52 virtual void DeleteDelegate() OVERRIDE; | |
53 virtual bool CanResize() const OVERRIDE; | |
54 virtual bool CanMaximize() const OVERRIDE; | |
55 virtual bool CanActivate() const OVERRIDE; | |
56 | |
57 // Called by widget. Attempts to close the foreign window. | |
58 void Close(); | |
59 | |
60 // Create a new views::WidgetDelegate. | |
61 views::WidgetDelegate* CreateWidgetDelegate(); | |
62 | |
63 // Returns the plugin window handle. | |
64 gfx::PluginWindowHandle GetWindowHandle() const; | |
65 | |
66 // Set plugin window properties. | |
danakj
2013/02/21 01:33:15
These don't change the plugin window right? They a
reveman
2013/02/22 01:26:44
Yes, these functions are called as a result of the
| |
67 void SetWindowSize(const gfx::Size& size); | |
68 void SetWindowVisible(bool visible); | |
69 | |
70 // Call when plugin window has been destroyed. | |
danakj
2013/02/21 01:33:15
"Called"? Or who should call?
reveman
2013/02/22 01:26:44
This is similar to the above functions. I changed
| |
71 void OnWindowDestroyed(); | |
72 | |
73 // Returns the native view. | |
74 gfx::NativeView GetNativeView() const; | |
75 | |
76 // Set foreign window display state. | |
77 void SetDisplayState(DisplayState state); | |
78 DisplayState GetDisplayState() const; | |
79 | |
80 // Returns true if foreign window is managed. | |
81 bool IsManaged() const; | |
82 | |
83 // Returns true if foreign window has been destroyed. | |
84 bool HasBeenDestroyed() const; | |
85 | |
86 private: | |
87 friend class base::RefCounted<ForeignWindow>; | |
88 virtual ~ForeignWindow(); | |
89 | |
90 scoped_ptr<ForeignWindowHost> host_; | |
91 gfx::Size preferred_size_; | |
92 base::WeakPtr<ForeignWindowClientView> client_view_; | |
93 DisplayState display_state_; | |
94 bool destroyed_; | |
95 | |
96 DISALLOW_COPY_AND_ASSIGN(ForeignWindow); | |
97 }; | |
98 | |
99 } // namespace wm | |
100 | |
101 #endif // WM_FOREIGN_WINDOW_H_ | |
OLD | NEW |