Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Unified Diff: wm/foreign_window.h

Issue 11485006: Add window manager component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add proper use_wm flag support Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: wm/foreign_window.h
diff --git a/wm/foreign_window.h b/wm/foreign_window.h
new file mode 100644
index 0000000000000000000000000000000000000000..54d6227a7cfd0440ef0bb740b54c396ab92426b6
--- /dev/null
+++ b/wm/foreign_window.h
@@ -0,0 +1,101 @@
+// 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.
+
+#ifndef WM_FOREIGN_WINDOW_H_
+#define WM_FOREIGN_WINDOW_H_
+
+#include "base/memory/ref_counted.h"
+#include "ui/views/widget/widget_delegate.h"
+#include "wm/host/foreign_window_host_delegate.h"
+
+namespace views {
+class ClientView;
+}
+
+namespace wm {
+class ForeignWindowClientView;
+class ForeignWindowHost;
+
+class ForeignWindow : public base::RefCounted<ForeignWindow>,
+ public ForeignWindowHostDelegate,
+ public views::WidgetDelegate {
+ public:
+ enum DisplayState {
+ DISPLAY_NORMAL,
+ DISPLAY_ICONIC,
+ DISPLAY_WITHDRAWN
+ };
+ struct CreateParams {
+ 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
+ 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.
+
+ gfx::PluginWindowHandle window_handle;
+ gfx::Size preferred_size;
+ };
+ explicit ForeignWindow(const CreateParams& params);
+
+ // Retrieves the ForeignWindow implementation associated with the
+ // given NativeView, or NULL if the supplied handle has no associated
+ // ForeignWindow.
+ static ForeignWindow* GetForeignWindowForNativeView(
+ gfx::NativeView native_view);
+
+ // Overridden from wm::ForeignWindowHostDelegate.
+ virtual void OnWindowContentsChanged() OVERRIDE;
+ 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.
+
+ // Overridden from views::WidgetDelegate:
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
+ virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+ virtual bool CanResize() const OVERRIDE;
+ virtual bool CanMaximize() const OVERRIDE;
+ virtual bool CanActivate() const OVERRIDE;
+
+ // Called by widget. Attempts to close the foreign window.
+ void Close();
+
+ // Create a new views::WidgetDelegate.
+ views::WidgetDelegate* CreateWidgetDelegate();
+
+ // Returns the plugin window handle.
+ gfx::PluginWindowHandle GetWindowHandle() const;
+
+ // 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
+ void SetWindowSize(const gfx::Size& size);
+ void SetWindowVisible(bool visible);
+
+ // 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
+ void OnWindowDestroyed();
+
+ // Returns the native view.
+ gfx::NativeView GetNativeView() const;
+
+ // Set foreign window display state.
+ void SetDisplayState(DisplayState state);
+ DisplayState GetDisplayState() const;
+
+ // Returns true if foreign window is managed.
+ bool IsManaged() const;
+
+ // Returns true if foreign window has been destroyed.
+ bool HasBeenDestroyed() const;
+
+ private:
+ friend class base::RefCounted<ForeignWindow>;
+ virtual ~ForeignWindow();
+
+ scoped_ptr<ForeignWindowHost> host_;
+ gfx::Size preferred_size_;
+ base::WeakPtr<ForeignWindowClientView> client_view_;
+ DisplayState display_state_;
+ bool destroyed_;
+
+ DISALLOW_COPY_AND_ASSIGN(ForeignWindow);
+};
+
+} // namespace wm
+
+#endif // WM_FOREIGN_WINDOW_H_

Powered by Google App Engine
This is Rietveld 408576698