| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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_EXTENSION_WINDOW_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WINDOW_CONTROLLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 | |
| 13 class BaseWindow; | |
| 14 class Browser; // TODO(stevenjb) eliminate this dependency. | |
| 15 class GURL; | |
| 16 class Profile; | |
| 17 class SessionID; | |
| 18 | |
| 19 namespace base { | |
| 20 class DictionaryValue; | |
| 21 } | |
| 22 | |
| 23 namespace extensions { | |
| 24 class Extension; | |
| 25 } | |
| 26 | |
| 27 namespace gfx { | |
| 28 class Rect; | |
| 29 } | |
| 30 | |
| 31 // This API needs to be implemented by any window that might be accessed | |
| 32 // through chrome.windows or chrome.tabs (e.g. browser windows and panels). | |
| 33 class ExtensionWindowController { | |
| 34 public: | |
| 35 enum Reason { | |
| 36 REASON_NONE, | |
| 37 REASON_NOT_EDITABLE, | |
| 38 }; | |
| 39 | |
| 40 ExtensionWindowController(BaseWindow* window, Profile* profile); | |
| 41 virtual ~ExtensionWindowController(); | |
| 42 | |
| 43 BaseWindow* window() const { return window_; } | |
| 44 | |
| 45 Profile* profile() const { return profile_; } | |
| 46 | |
| 47 // Return an id uniquely identifying the window. | |
| 48 virtual int GetWindowId() const = 0; | |
| 49 | |
| 50 // Return the type name for the window. | |
| 51 virtual std::string GetWindowTypeText() const = 0; | |
| 52 | |
| 53 // Populates a dictionary for the Window object. Override this to set | |
| 54 // implementation specific properties (call the base implementation first to | |
| 55 // set common properties). | |
| 56 virtual base::DictionaryValue* CreateWindowValue() const; | |
| 57 | |
| 58 // Populates a dictionary for the Window object, including a list of tabs. | |
| 59 virtual base::DictionaryValue* CreateWindowValueWithTabs() const = 0; | |
| 60 | |
| 61 // Returns false if the window is in a state where closing the window is not | |
| 62 // permitted and sets |reason| if not NULL. | |
| 63 virtual bool CanClose(Reason* reason) const = 0; | |
| 64 | |
| 65 // Set the window's fullscreen state. |extension_url| provides the url | |
| 66 // associated with the extension (used by FullscreenController). | |
| 67 virtual void SetFullscreenMode(bool is_fullscreen, | |
| 68 const GURL& extension_url) const = 0; | |
| 69 | |
| 70 // Returns a Browser if available. Defaults to returning NULL. | |
| 71 // TODO(stevenjb): Temporary workaround. Eliminate this. | |
| 72 virtual Browser* GetBrowser() const; | |
| 73 | |
| 74 // Extension/window visibility and ownership is window-specific, subclasses | |
| 75 // need to define this behavior. | |
| 76 virtual bool IsVisibleToExtension( | |
| 77 const extensions::Extension* extension) const = 0; | |
| 78 | |
| 79 private: | |
| 80 BaseWindow* window_; | |
| 81 Profile* profile_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(ExtensionWindowController); | |
| 84 }; | |
| 85 | |
| 86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WINDOW_CONTROLLER_H_ | |
| OLD | NEW |