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/offscreen_tabs/offscreen_tabs_api.h" | 5 #include "chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 scoped_ptr<ListValue> args(new ListValue()); | 258 scoped_ptr<ListValue> args(new ListValue()); |
259 args->Append(Value::CreateIntegerValue( | 259 args->Append(Value::CreateIntegerValue( |
260 ExtensionTabUtil::GetTabId(web_contents()))); | 260 ExtensionTabUtil::GetTabId(web_contents()))); |
261 args->Append(changed_properties); | 261 args->Append(changed_properties); |
262 args->Append(CreateValue()); | 262 args->Append(CreateValue()); |
263 | 263 |
264 // The event router only dispatches the event to renderers listening for the | 264 // The event router only dispatches the event to renderers listening for the |
265 // event. | 265 // event. |
266 Profile* profile = Profile::FromBrowserContext( | 266 Profile* profile = Profile::FromBrowserContext( |
267 parent_tab_->web_contents()->GetBrowserContext()); | 267 parent_tab_->web_contents()->GetBrowserContext()); |
| 268 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 269 events::kOnOffscreenTabUpdated, args.Pass())); |
| 270 event->restrict_to_profile = profile; |
268 extensions::ExtensionSystem::Get(profile)->event_router()-> | 271 extensions::ExtensionSystem::Get(profile)->event_router()-> |
269 DispatchEventToRenderers( | 272 BroadcastEvent(event.Pass()); |
270 events::kOnOffscreenTabUpdated, args.Pass(), profile, GURL(), | |
271 extensions::EventFilteringInfo()); | |
272 } | 273 } |
273 | 274 |
274 ParentTab::ParentTab() : web_contents_(NULL) {} | 275 ParentTab::ParentTab() : web_contents_(NULL) {} |
275 ParentTab::~ParentTab() {} | 276 ParentTab::~ParentTab() {} |
276 | 277 |
277 void ParentTab::Init(WebContents* web_contents) { | 278 void ParentTab::Init(WebContents* web_contents) { |
278 CHECK(web_contents); | 279 CHECK(web_contents); |
279 web_contents_ = web_contents; | 280 web_contents_ = web_contents; |
280 | 281 |
281 // Register for tab notifications. | 282 // Register for tab notifications. |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 // async case (when a "javascript": URL is sent to a tab). | 819 // async case (when a "javascript": URL is sent to a tab). |
819 if (!is_async) | 820 if (!is_async) |
820 SendResponse(true); | 821 SendResponse(true); |
821 | 822 |
822 return true; | 823 return true; |
823 } | 824 } |
824 | 825 |
825 void UpdateOffscreenTabFunction::PopulateResult() { | 826 void UpdateOffscreenTabFunction::PopulateResult() { |
826 // There's no result associated with this callback. | 827 // There's no result associated with this callback. |
827 } | 828 } |
OLD | NEW |