Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: chrome/browser/extensions/extension_window_controller.h

Issue 9428018: Create BaseWindow and ExtensionWindowWrapper for extension API access to Panels (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
34 ExtensionWindowController(BaseWindow* window, Profile* profile);
35 virtual ~ExtensionWindowController();
36
37 BaseWindow* window() const { return window_; }
sky 2012/02/24 04:38:24 nit: since you're returning a non-const value, thi
stevenjb 2012/02/24 19:25:06 I copied the pattern from browser.h. Since this do
38
39 // Returns true if the window matches the profile.
40 virtual bool MatchesProfile(Profile* profile, bool allow_incognito) const;
sky 2012/02/24 04:38:24 Does this need to be virtual?
stevenjb 2012/02/24 19:25:06 It does not any more, thanks. Done.
41
42 // Return a session id uniquely identifying the window.
43 virtual const SessionID& GetSessionId() const = 0;
44
45 // Populates a dictionary for the Window object.
46 virtual base::DictionaryValue* CreateWindowValue() const = 0;
47
48 // Populates a dictionary for the Window object, including a list of tabs.
49 virtual base::DictionaryValue* CreateWindowValueWithTabs() const = 0;
50
51 // Returns false if the window is in a state where closing the window is not
52 // permitted and sets |reason| if not NULL.
53 virtual bool CanClose(Reason* reason) const = 0;
54
55 // Set the window's fullscreen state. |extension_url| provides the url
56 // associated with the extension (used by FullscreenController).
57 virtual void SetFullscreenMode(bool is_fullscreen,
58 const GURL& extension_url) const = 0;
59
60 protected:
61 // Helper function to set bounds properties.
62 void SetWindowValueBounds(const gfx::Rect& bounds,
63 base::DictionaryValue* result) const;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698