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

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

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing memory leak in a test. Created 8 years, 4 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
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_EVENT_ROUTER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_WINDOW_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_EVENT_ROUTER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_WINDOW_EVENT_ROUTER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/extensions/window_controller_list_observer.h" 10 #include "chrome/browser/extensions/window_controller_list_observer.h"
10 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
12 #if defined(TOOLKIT_VIEWS) 13 #if defined(TOOLKIT_VIEWS)
13 #include "ui/views/focus/widget_focus_manager.h" 14 #include "ui/views/focus/widget_focus_manager.h"
14 #elif defined(TOOLKIT_GTK) 15 #elif defined(TOOLKIT_GTK)
15 #include "ui/base/x/active_window_watcher_x_observer.h" 16 #include "ui/base/x/active_window_watcher_x_observer.h"
16 #endif 17 #endif
17 18
18 class Profile; 19 class Profile;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 virtual void Observe(int type, 59 virtual void Observe(int type,
59 const content::NotificationSource& source, 60 const content::NotificationSource& source,
60 const content::NotificationDetails& details) OVERRIDE; 61 const content::NotificationDetails& details) OVERRIDE;
61 62
62 // |window_controller| is NULL to indicate a focused window has lost focus. 63 // |window_controller| is NULL to indicate a focused window has lost focus.
63 void OnActiveWindowChanged(WindowController* window_controller); 64 void OnActiveWindowChanged(WindowController* window_controller);
64 65
65 private: 66 private:
66 void DispatchEvent(const char* event_name, 67 void DispatchEvent(const char* event_name,
67 Profile* profile, 68 Profile* profile,
68 base::ListValue* args); 69 scoped_ptr<base::ListValue> args);
69 70
70 content::NotificationRegistrar registrar_; 71 content::NotificationRegistrar registrar_;
71 bool initialized_; 72 bool initialized_;
72 73
73 // The main profile that owns this event router. 74 // The main profile that owns this event router.
74 Profile* profile_; 75 Profile* profile_;
75 76
76 // The profile the currently focused window belongs to; either the main or 77 // The profile the currently focused window belongs to; either the main or
77 // incognito profile or NULL (none of the above). We remember this in order 78 // incognito profile or NULL (none of the above). We remember this in order
78 // to correctly handle focus changes between non-OTR and OTR windows. 79 // to correctly handle focus changes between non-OTR and OTR windows.
79 Profile* focused_profile_; 80 Profile* focused_profile_;
80 81
81 // The currently focused window. We keep this so as to avoid sending multiple 82 // The currently focused window. We keep this so as to avoid sending multiple
82 // windows.onFocusChanged events with the same windowId. 83 // windows.onFocusChanged events with the same windowId.
83 int focused_window_id_; 84 int focused_window_id_;
84 85
85 DISALLOW_COPY_AND_ASSIGN(WindowEventRouter); 86 DISALLOW_COPY_AND_ASSIGN(WindowEventRouter);
86 }; 87 };
87 88
88 } // namespace extensions 89 } // namespace extensions
89 90
90 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_EVENT_ROUTER_H_ 91 #endif // CHROME_BROWSER_EXTENSIONS_WINDOW_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/system/system_api.cc ('k') | chrome/browser/extensions/window_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698