OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/containers/scoped_ptr_hash_map.h" |
| 12 #include "chrome/browser/extensions/window_controller.h" |
| 13 #include "ui/base/base_window.h" |
| 14 |
| 15 class Profile; |
| 16 |
| 17 namespace extensions { |
| 18 |
| 19 class AppWindow; |
| 20 class AppBaseWindow; |
| 21 class NativeAppWindow; |
| 22 |
| 23 // A custom ui::BaseWindow to be given to a WindowController. It |
| 24 // allows us to constrain some operations on application windows (like |
| 25 // SetBounds). |
| 26 class AppBaseWindow : public ui::BaseWindow { |
| 27 public: |
| 28 explicit AppBaseWindow(AppWindow* app_window); |
| 29 virtual ~AppBaseWindow(); |
| 30 |
| 31 private: |
| 32 bool IsActive() const override; |
| 33 bool IsMaximized() const override; |
| 34 bool IsMinimized() const override; |
| 35 bool IsFullscreen() const override; |
| 36 gfx::NativeWindow GetNativeWindow() const override; |
| 37 gfx::Rect GetRestoredBounds() const override; |
| 38 ui::WindowShowState GetRestoredState() const override; |
| 39 gfx::Rect GetBounds() const override; |
| 40 void Show() override; |
| 41 void Hide() override; |
| 42 void ShowInactive() override; |
| 43 void Close() override; |
| 44 void Activate() override; |
| 45 void Deactivate() override; |
| 46 void Maximize() override; |
| 47 void Minimize() override; |
| 48 void Restore() override; |
| 49 void SetBounds(const gfx::Rect& bounds) override; |
| 50 void FlashFrame(bool flash) override; |
| 51 bool IsAlwaysOnTop() const override; |
| 52 void SetAlwaysOnTop(bool always_on_top) override; |
| 53 |
| 54 NativeAppWindow* GetBaseWindow() const; |
| 55 |
| 56 AppWindow* app_window_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(AppBaseWindow); |
| 59 }; |
| 60 |
| 61 // A extensions::WindowController specific to extensions::AppWindow. |
| 62 class AppWindowController : public WindowController { |
| 63 public: |
| 64 AppWindowController(AppWindow* window, |
| 65 scoped_ptr<AppBaseWindow> base_window, |
| 66 Profile* profile); |
| 67 ~AppWindowController() override; |
| 68 |
| 69 // extensions::WindowController: |
| 70 int GetWindowId() const override; |
| 71 std::string GetWindowTypeText() const override; |
| 72 base::DictionaryValue* CreateWindowValueWithTabs( |
| 73 const Extension* extension) const override; |
| 74 base::DictionaryValue* CreateTabValue(const Extension* extension, |
| 75 int tab_index) const override; |
| 76 bool CanClose(Reason* reason) const override; |
| 77 void SetFullscreenMode(bool is_fullscreen, |
| 78 const GURL& extension_url) const override; |
| 79 Browser* GetBrowser() const override; |
| 80 bool IsVisibleToExtension(const Extension* extension) const override; |
| 81 |
| 82 private: |
| 83 AppWindow* app_window_; // Owns us. |
| 84 scoped_ptr<AppBaseWindow> base_window_; |
| 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(AppWindowController); |
| 87 }; |
| 88 |
| 89 } // namespace extensions |
| 90 |
| 91 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_APP_WINDOW_CONTROLLER_H_ |
OLD | NEW |