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

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

Issue 10777004: Support chrome.windows extension API events for browserless Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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_PANEL_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PANEL_EVENT_ROUTER_H_
7
8 #include "content/public/browser/notification_observer.h"
9 #include "content/public/browser/notification_registrar.h"
10
11 class Panel;
12 class Profile;
13
14 // The ExtensinoPanelEventRouter listens to Panel window events
15 // and routes them to listeners inside extension process renderers.
16 class ExtensionPanelEventRouter : public content::NotificationObserver {
17 public:
18 explicit ExtensionPanelEventRouter(Profile* profile);
19 virtual ~ExtensionPanelEventRouter();
20
21 // Must be called once. Subsequent calls have no effect.
22 void Init();
23
24 // content::NotificationObserver.
25 virtual void Observe(int type,
26 const content::NotificationSource& source,
27 const content::NotificationDetails& details) OVERRIDE;
28 private:
29 void OnPanelOpened(Panel* panel);
30 void OnPanelActiveStatusChanged(Panel* panel, bool is_active_now);
31 void OnPanelClosed(Panel* panel);
32
33 content::NotificationRegistrar registrar_;
34
35 bool initialized_;
36
37 // The main profile that owns this event router.
38 Profile* profile_;
39
40 // The profile the currently focused panel belongs to; either the main or
41 // incognito profile or NULL (none of the above). We remember this in order
42 // to correctly handle focus changes between non-OTR and OTR panels.
43 Profile* focused_profile_;
44
45 // The currently focused panel. We keep this so as to avoid sending multiple
46 // windows.onFocusChanged events with the same windowId.
47 int focused_window_id_;
48
49 DISALLOW_COPY_AND_ASSIGN(ExtensionPanelEventRouter);
50 };
51
52 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PANEL_EVENT_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698