Index: chrome/browser/extensions/api/tabs/app_window_controller.h |
diff --git a/chrome/browser/extensions/api/tabs/app_window_controller.h b/chrome/browser/extensions/api/tabs/app_window_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6fe29001cbd906f8328a92bf33f5107540861c2a |
--- /dev/null |
+++ b/chrome/browser/extensions/api/tabs/app_window_controller.h |
@@ -0,0 +1,91 @@ |
+// Copyright 2015 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 CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_ |
+#define CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/containers/scoped_ptr_hash_map.h" |
+#include "chrome/browser/extensions/window_controller.h" |
+#include "ui/base/base_window.h" |
+ |
+class Profile; |
+ |
+namespace extensions { |
+ |
+class AppWindow; |
+class AppBaseWindow; |
+class NativeAppWindow; |
+ |
+// A custom ui::BaseWindow to be given to a WindowController. It |
+// allows us to constrain some operations on application windows (like |
+// SetBounds). |
+class AppBaseWindow : public ui::BaseWindow { |
+ public: |
+ explicit AppBaseWindow(AppWindow* app_window); |
+ virtual ~AppBaseWindow(); |
+ |
+ private: |
+ bool IsActive() const override; |
+ bool IsMaximized() const override; |
+ bool IsMinimized() const override; |
+ bool IsFullscreen() const override; |
+ gfx::NativeWindow GetNativeWindow() const override; |
+ gfx::Rect GetRestoredBounds() const override; |
+ ui::WindowShowState GetRestoredState() const override; |
+ gfx::Rect GetBounds() const override; |
+ void Show() override; |
+ void Hide() override; |
+ void ShowInactive() override; |
+ void Close() override; |
+ void Activate() override; |
+ void Deactivate() override; |
+ void Maximize() override; |
+ void Minimize() override; |
+ void Restore() override; |
+ void SetBounds(const gfx::Rect& bounds) override; |
+ void FlashFrame(bool flash) override; |
+ bool IsAlwaysOnTop() const override; |
+ void SetAlwaysOnTop(bool always_on_top) override; |
+ |
+ NativeAppWindow* GetBaseWindow() const; |
+ |
+ AppWindow* app_window_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppBaseWindow); |
+}; |
+ |
+// A extensions::WindowController specific to extensions::AppWindow. |
+class AppWindowController : public WindowController { |
+ public: |
+ AppWindowController(AppWindow* window, |
+ scoped_ptr<AppBaseWindow> base_window, |
+ Profile* profile); |
+ ~AppWindowController() override; |
+ |
+ // extensions::WindowController: |
+ int GetWindowId() const override; |
+ std::string GetWindowTypeText() const override; |
+ base::DictionaryValue* CreateWindowValueWithTabs( |
+ const Extension* extension) const override; |
+ base::DictionaryValue* CreateTabValue(const Extension* extension, |
+ int tab_index) const override; |
+ bool CanClose(Reason* reason) const override; |
+ void SetFullscreenMode(bool is_fullscreen, |
+ const GURL& extension_url) const override; |
+ Browser* GetBrowser() const override; |
+ bool IsVisibleToExtension(const Extension* extension) const override; |
+ |
+ private: |
+ AppWindow* app_window_; // Owns us. |
+ scoped_ptr<AppBaseWindow> base_window_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppWindowController); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_ |