| OLD | NEW |
| 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 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" | 5 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (focused_window_id_ == window_id) | 133 if (focused_window_id_ == window_id) |
| 134 return; | 134 return; |
| 135 | 135 |
| 136 // window_profile is either the default profile for the active window, its | 136 // window_profile is either the default profile for the active window, its |
| 137 // incognito profile, or NULL iff the previous profile is losing focus. | 137 // incognito profile, or NULL iff the previous profile is losing focus. |
| 138 focused_profile_ = window_profile; | 138 focused_profile_ = window_profile; |
| 139 focused_window_id_ = window_id; | 139 focused_window_id_ = window_id; |
| 140 | 140 |
| 141 scoped_ptr<Event> event(new Event(windows::OnFocusChanged::kEventName, | 141 scoped_ptr<Event> event(new Event(events::UNKNOWN, |
| 142 windows::OnFocusChanged::kEventName, |
| 142 make_scoped_ptr(new base::ListValue()))); | 143 make_scoped_ptr(new base::ListValue()))); |
| 143 event->will_dispatch_callback = | 144 event->will_dispatch_callback = |
| 144 base::Bind(&WillDispatchWindowFocusedEvent, | 145 base::Bind(&WillDispatchWindowFocusedEvent, |
| 145 static_cast<BrowserContext*>(window_profile), | 146 static_cast<BrowserContext*>(window_profile), |
| 146 window_id); | 147 window_id); |
| 147 EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); | 148 EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void WindowsEventRouter::DispatchEvent(const std::string& event_name, | 151 void WindowsEventRouter::DispatchEvent(const std::string& event_name, |
| 151 Profile* profile, | 152 Profile* profile, |
| 152 scoped_ptr<base::ListValue> args) { | 153 scoped_ptr<base::ListValue> args) { |
| 153 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 154 scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass())); |
| 154 event->restrict_to_browser_context = profile; | 155 event->restrict_to_browser_context = profile; |
| 155 EventRouter::Get(profile)->BroadcastEvent(event.Pass()); | 156 EventRouter::Get(profile)->BroadcastEvent(event.Pass()); |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace extensions | 159 } // namespace extensions |
| OLD | NEW |