desktop_controller.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2014 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. #ifndef EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_
  5. #define EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_
  6. #include <memory>
  7. #include "ui/gfx/native_widget_types.h"
  8. namespace base {
  9. class RunLoop;
  10. }
  11. namespace extensions {
  12. class AppWindow;
  13. // DesktopController is an interface to construct the window environment in
  14. // extensions shell. ShellDesktopControllerAura provides a default
  15. // implementation for app_shell, and other embedders can provide their own.
  16. // TODO(jamescook|oshima): Clean up this interface now that there is only one
  17. // way to create an app window.
  18. class DesktopController {
  19. public:
  20. DesktopController();
  21. virtual ~DesktopController();
  22. // Returns the single instance of the desktop. (Stateless functions like
  23. // ShellAppWindowCreateFunction need to be able to access the desktop, so
  24. // we need a singleton somewhere).
  25. static DesktopController* instance();
  26. // Forwarded from BrowserMainParts.
  27. virtual void PreMainMessageLoopRun() {}
  28. virtual void WillRunMainMessageLoop(
  29. std::unique_ptr<base::RunLoop>& run_loop) {}
  30. virtual void PostMainMessageLoopRun() {}
  31. // Attaches the window to our window hierarchy.
  32. virtual void AddAppWindow(AppWindow* app_window,
  33. gfx::NativeWindow window) = 0;
  34. // Closes and destroys the app windows.
  35. virtual void CloseAppWindows() = 0;
  36. };
  37. } // namespace extensions
  38. #endif // EXTENSIONS_SHELL_BROWSER_DESKTOP_CONTROLLER_H_