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 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" |
| 11 |
| 12 class BaseWindow; |
| 13 class GURL; |
| 14 class Profile; |
| 15 class SessionID; |
| 16 |
| 17 namespace base { |
| 18 class DictionaryValue; |
| 19 } |
| 20 |
| 21 namespace gfx { |
| 22 class Rect; |
| 23 } |
| 24 |
| 25 // This API needs to be implemented by any window that might be accessed |
| 26 // through chrome.windows or chrome.tabs (e.g. browser windows and panels). |
| 27 class ExtensionWindowController { |
| 28 public: |
| 29 enum Reason { |
| 30 REASON_NONE, |
| 31 REASON_TAB_STRIP_NOT_EDITABLE, |
| 32 }; |
| 33 enum ProfileMatchType { |
| 34 MATCH_NORMAL_ONLY, |
| 35 MATCH_INCOGNITO |
| 36 }; |
| 37 ExtensionWindowController(BaseWindow* window, Profile* profile); |
| 38 virtual ~ExtensionWindowController(); |
| 39 |
| 40 BaseWindow* window() const { return window_; } |
| 41 |
| 42 // Returns true if the window matches the profile. |
| 43 bool MatchesProfile(Profile* profile, ProfileMatchType match_type) const; |
| 44 |
| 45 // Populates a dictionary for the Window object. Override this to set |
| 46 // implementation specific properties (call the base implementation first to |
| 47 // set common properties). |
| 48 virtual base::DictionaryValue* CreateWindowValue() const; |
| 49 |
| 50 // Return a session id uniquely identifying the window. |
| 51 virtual const SessionID& GetSessionId() const = 0; |
| 52 |
| 53 // Populates a dictionary for the Window object, including a list of tabs. |
| 54 virtual base::DictionaryValue* CreateWindowValueWithTabs() const = 0; |
| 55 |
| 56 // Returns false if the window is in a state where closing the window is not |
| 57 // permitted and sets |reason| if not NULL. |
| 58 virtual bool CanClose(Reason* reason) const = 0; |
| 59 |
| 60 // Set the window's fullscreen state. |extension_url| provides the url |
| 61 // associated with the extension (used by FullscreenController). |
| 62 virtual void SetFullscreenMode(bool is_fullscreen, |
| 63 const GURL& extension_url) const = 0; |
| 64 |
| 65 private: |
| 66 BaseWindow* window_; |
| 67 Profile* profile_; |
| 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(ExtensionWindowController); |
| 70 }; |
| 71 |
| 72 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WINDOW_CONTROLLER_H_ |
OLD | NEW |