Fix crash when a webview tries to load a plugin resource.
[chromium-blink-merge.git] / ash / display / mirror_window_controller.h
blob5b24cc6a1b64c968d210effe175b9a57afe7ec25
1 // Copyright (c) 2013 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.
5 #ifndef ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_
6 #define ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/window_tree_host_observer.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/native_widget_types.h"
16 namespace aura {
17 class Window;
20 namespace ui {
21 class Reflector;
24 namespace ash {
25 class AshWindowTreeHost;
26 class DisplayInfo;
27 class RootWindowTransformer;
29 namespace test{
30 class MirrorWindowTestApi;
33 // An object that copies the content of the primary root window to a
34 // mirror window. This also draws a mouse cursor as the mouse cursor
35 // is typically drawn by the window system.
36 class ASH_EXPORT MirrorWindowController : public aura::WindowTreeHostObserver {
37 public:
38 MirrorWindowController();
39 ~MirrorWindowController() override;
41 // Updates the root window's bounds using |display_info|.
42 // Creates the new root window if one doesn't exist.
43 void UpdateWindow(const DisplayInfo& display_info);
45 // Same as above, but using existing display info
46 // for the mirrored display.
47 void UpdateWindow();
49 // Close the mirror window.
50 void Close();
52 // aura::WindowTreeHostObserver overrides:
53 void OnHostResized(const aura::WindowTreeHost* host) override;
55 // Return the root window used to mirror the content. NULL if the
56 // display is not mirrored by the compositor path.
57 aura::Window* GetWindow();
59 private:
60 friend class test::MirrorWindowTestApi;
62 // Creates a RootWindowTransformer for current display
63 // configuration.
64 scoped_ptr<RootWindowTransformer> CreateRootWindowTransformer() const;
66 scoped_ptr<AshWindowTreeHost> ash_host_;
67 gfx::Size mirror_window_host_size_;
68 scoped_ptr<ui::Reflector> reflector_;
70 DISALLOW_COPY_AND_ASSIGN(MirrorWindowController);
73 } // namespace ash
75 #endif // ASH_DISPLAY_MIRROR_WINDOW_CONTROLLER_H_