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

Unified Diff: chrome/browser/extensions/api/tabs/windows_event_router.h

Issue 1099553002: extensions: windows: list all windows from the current profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add application windows resize constraint test Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tabs/windows_event_router.h
diff --git a/chrome/browser/extensions/api/tabs/windows_event_router.h b/chrome/browser/extensions/api/tabs/windows_event_router.h
index 1f87493f4ac6dd2c488f283ef3427b92873ec074..c83b94c16fd480dca404166d0883a5be2ebacae8 100644
--- a/chrome/browser/extensions/api/tabs/windows_event_router.h
+++ b/chrome/browser/extensions/api/tabs/windows_event_router.h
@@ -5,13 +5,16 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_EVENT_ROUTER_H_
#define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_EVENT_ROUTER_H_
+#include <map>
#include <string>
#include "base/basictypes.h"
+#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/window_controller_list_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/app_window/app_window_registry.h"
#if !defined(OS_MACOSX)
#include "ui/views/focus/widget_focus_manager.h"
@@ -25,19 +28,29 @@ class ListValue;
namespace extensions {
+class AppWindow;
+class AppWindowController;
+
// The WindowsEventRouter sends chrome.windows.* events to listeners
// inside extension process renderers. The router listens to *all* events,
// but will only route events within a profile to extension processes in the
// same profile.
-class WindowsEventRouter : public WindowControllerListObserver,
+class WindowsEventRouter : public AppWindowRegistry::Observer,
+ public WindowControllerListObserver,
#if !defined(OS_MACOSX)
- public views::WidgetFocusChangeListener,
+ public views::WidgetFocusChangeListener,
#endif
- public content::NotificationObserver {
+ public content::NotificationObserver {
public:
explicit WindowsEventRouter(Profile* profile);
~WindowsEventRouter() override;
+ void DispatchEvents();
dcheng 2015/06/29 18:15:49 The name of this member makes it sound like this a
llandwerlin-old 2015/06/30 10:20:47 Done.
+
+ // extensions::AppWindowRegistry::Observer:
+ void OnAppWindowAdded(extensions::AppWindow* app_window) override;
+ void OnAppWindowRemoved(extensions::AppWindow* app_window) override;
+
// WindowControllerListObserver methods:
void OnWindowControllerAdded(WindowController* window_controller) override;
void OnWindowControllerRemoved(WindowController* window) override;
@@ -73,6 +86,12 @@ class WindowsEventRouter : public WindowControllerListObserver,
// windows.onFocusChanged events with the same windowId.
int focused_window_id_;
+ // Whether to dispatch events.
+ bool dispatch_events_;
+
+ // Map of application windows.
+ base::ScopedPtrHashMap<int, scoped_ptr<AppWindowController>> app_windows_;
+
DISALLOW_COPY_AND_ASSIGN(WindowsEventRouter);
};

Powered by Google App Engine
This is Rietveld 408576698