Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 class Rect; | 23 class Rect; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 class BaseWindow; | 27 class BaseWindow; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace extensions { | 30 namespace extensions { |
| 31 class Extension; | 31 class Extension; |
| 32 | 32 |
| 33 // A bitmaks used as filter on window types. | |
| 34 typedef uint32 WindowTypeFilter; | |
|
not at google - send to devlin
2015/08/05 17:33:25
We're supposed to use "using" these days. I'd also
llandwerlin-old
2015/08/05 18:12:02
Done.
| |
| 35 | |
| 33 // This API needs to be implemented by any window that might be accessed | 36 // This API needs to be implemented by any window that might be accessed |
| 34 // through chrome.windows or chrome.tabs (e.g. browser windows and panels). | 37 // through chrome.windows or chrome.tabs (e.g. browser windows and panels). |
| 35 // Subclasses must add/remove themselves from the WindowControllerList | 38 // Subclasses must add/remove themselves from the WindowControllerList |
| 36 // upon construction/destruction. | 39 // upon construction/destruction. |
| 37 class WindowController { | 40 class WindowController { |
| 38 public: | 41 public: |
| 39 enum Reason { | 42 enum Reason { |
| 40 REASON_NONE, | 43 REASON_NONE, |
| 41 REASON_NOT_EDITABLE, | 44 REASON_NOT_EDITABLE, |
| 42 }; | 45 }; |
| 43 | 46 |
| 47 // Returns a filter allowing all window types to be manipulated | |
| 48 // through the chrome.windows APIs. | |
| 49 static WindowTypeFilter GetAllWindowFilter(); | |
| 50 | |
| 51 // Returns the default filter to be used when operating on the windows | |
| 52 // from WindowControllerList when using the chrome.windows APIs. | |
| 53 static WindowTypeFilter GetDefaultWindowFilter(); | |
| 54 | |
| 44 WindowController(ui::BaseWindow* window, Profile* profile); | 55 WindowController(ui::BaseWindow* window, Profile* profile); |
| 45 virtual ~WindowController(); | 56 virtual ~WindowController(); |
| 46 | 57 |
| 47 ui::BaseWindow* window() const { return window_; } | 58 ui::BaseWindow* window() const { return window_; } |
| 48 | 59 |
| 49 Profile* profile() const { return profile_; } | 60 Profile* profile() const { return profile_; } |
| 50 | 61 |
| 51 // Return an id uniquely identifying the window. | 62 // Return an id uniquely identifying the window. |
| 52 virtual int GetWindowId() const = 0; | 63 virtual int GetWindowId() const = 0; |
| 53 | 64 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 76 const GURL& extension_url) const = 0; | 87 const GURL& extension_url) const = 0; |
| 77 | 88 |
| 78 // Returns a Browser if available. Defaults to returning NULL. | 89 // Returns a Browser if available. Defaults to returning NULL. |
| 79 // TODO(stevenjb): Temporary workaround. Eliminate this. | 90 // TODO(stevenjb): Temporary workaround. Eliminate this. |
| 80 virtual Browser* GetBrowser() const; | 91 virtual Browser* GetBrowser() const; |
| 81 | 92 |
| 82 // Extension/window visibility and ownership is window-specific, subclasses | 93 // Extension/window visibility and ownership is window-specific, subclasses |
| 83 // need to define this behavior. | 94 // need to define this behavior. |
| 84 virtual bool IsVisibleToExtension(const Extension* extension) const = 0; | 95 virtual bool IsVisibleToExtension(const Extension* extension) const = 0; |
| 85 | 96 |
| 97 // Returns true if the window type of |controller| matches the |filter|. | |
| 98 bool MatchesFilter(WindowTypeFilter filter) const; | |
| 99 | |
| 86 private: | 100 private: |
| 87 ui::BaseWindow* window_; | 101 ui::BaseWindow* window_; |
| 88 Profile* profile_; | 102 Profile* profile_; |
| 89 | 103 |
| 90 DISALLOW_COPY_AND_ASSIGN(WindowController); | 104 DISALLOW_COPY_AND_ASSIGN(WindowController); |
| 91 }; | 105 }; |
| 92 | 106 |
| 93 } // namespace extensions | 107 } // namespace extensions |
| 94 | 108 |
| 95 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_H_ | 109 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_CONTROLLER_H_ |
| OLD | NEW |