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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 scoped_ptr<ListValue> args(new ListValue()); | 275 scoped_ptr<ListValue> args(new ListValue()); |
276 args->Append(Value::CreateIntegerValue( | 276 args->Append(Value::CreateIntegerValue( |
277 ExtensionTabUtil::GetTabId(web_contents()))); | 277 ExtensionTabUtil::GetTabId(web_contents()))); |
278 args->Append(changed_properties); | 278 args->Append(changed_properties); |
279 args->Append(CreateValue()); | 279 args->Append(CreateValue()); |
280 | 280 |
281 // The event router only dispatches the event to renderers listening for the | 281 // The event router only dispatches the event to renderers listening for the |
282 // event. | 282 // event. |
283 Profile* profile = parent_tab_->tab_contents()->profile(); | 283 Profile* profile = parent_tab_->tab_contents()->profile(); |
| 284 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 285 events::kOnOffscreenTabUpdated, args.Pass())); |
| 286 event->restrict_to_profile = profile; |
284 extensions::ExtensionSystem::Get(profile)->event_router()-> | 287 extensions::ExtensionSystem::Get(profile)->event_router()-> |
285 DispatchEventToRenderers( | 288 BroadcastEvent(event.Pass()); |
286 events::kOnOffscreenTabUpdated, args.Pass(), profile, GURL(), | |
287 extensions::EventFilteringInfo()); | |
288 } | 289 } |
289 | 290 |
290 ParentTab::ParentTab() : tab_contents_(NULL) {} | 291 ParentTab::ParentTab() : tab_contents_(NULL) {} |
291 ParentTab::~ParentTab() {} | 292 ParentTab::~ParentTab() {} |
292 | 293 |
293 void ParentTab::Init(WebContents* web_contents) { | 294 void ParentTab::Init(WebContents* web_contents) { |
294 CHECK(web_contents); | 295 CHECK(web_contents); |
295 | 296 |
296 tab_contents_ = TabContents::FromWebContents(web_contents); | 297 tab_contents_ = TabContents::FromWebContents(web_contents); |
297 | 298 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 // async case (when a "javascript": URL is sent to a tab). | 837 // async case (when a "javascript": URL is sent to a tab). |
837 if (!is_async) | 838 if (!is_async) |
838 SendResponse(true); | 839 SendResponse(true); |
839 | 840 |
840 return true; | 841 return true; |
841 } | 842 } |
842 | 843 |
843 void UpdateOffscreenTabFunction::PopulateResult() { | 844 void UpdateOffscreenTabFunction::PopulateResult() { |
844 // There's no result associated with this callback. | 845 // There's no result associated with this callback. |
845 } | 846 } |
OLD | NEW |