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" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_constants.
h" | 18 #include "chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_constants.
h" |
19 #include "chrome/browser/extensions/api/tabs/tabs.h" | 19 #include "chrome/browser/extensions/api/tabs/tabs.h" |
20 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 20 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
21 #include "chrome/browser/extensions/event_names.h" | 21 #include "chrome/browser/extensions/event_names.h" |
22 #include "chrome/browser/extensions/event_router.h" | 22 #include "chrome/browser/extensions/event_router.h" |
23 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 23 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/extensions/extension_system.h" |
25 #include "chrome/browser/extensions/extension_tab_util.h" | 26 #include "chrome/browser/extensions/extension_tab_util.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
29 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 30 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
30 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 31 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
31 #include "chrome/common/chrome_notification_types.h" | 32 #include "chrome/common/chrome_notification_types.h" |
32 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
33 #include "chrome/common/extensions/extension_error_utils.h" | 34 #include "chrome/common/extensions/extension_error_utils.h" |
34 #include "chrome/common/extensions/extension_messages.h" | 35 #include "chrome/common/extensions/extension_messages.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 276 |
276 scoped_ptr<ListValue> args(new ListValue()); | 277 scoped_ptr<ListValue> args(new ListValue()); |
277 args->Append(Value::CreateIntegerValue( | 278 args->Append(Value::CreateIntegerValue( |
278 ExtensionTabUtil::GetTabId(web_contents()))); | 279 ExtensionTabUtil::GetTabId(web_contents()))); |
279 args->Append(changed_properties); | 280 args->Append(changed_properties); |
280 args->Append(CreateValue()); | 281 args->Append(CreateValue()); |
281 | 282 |
282 // The event router only dispatches the event to renderers listening for the | 283 // The event router only dispatches the event to renderers listening for the |
283 // event. | 284 // event. |
284 Profile* profile = parent_tab_->tab_contents()->profile(); | 285 Profile* profile = parent_tab_->tab_contents()->profile(); |
285 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 286 extensions::ExtensionSystem::Get(profile)->event_router()-> |
286 events::kOnOffscreenTabUpdated, args.Pass(), profile, GURL(), | 287 DispatchEventToRenderers( |
287 extensions::EventFilteringInfo()); | 288 events::kOnOffscreenTabUpdated, args.Pass(), profile, GURL(), |
| 289 extensions::EventFilteringInfo()); |
288 } | 290 } |
289 | 291 |
290 ParentTab::ParentTab() : tab_contents_(NULL) {} | 292 ParentTab::ParentTab() : tab_contents_(NULL) {} |
291 ParentTab::~ParentTab() {} | 293 ParentTab::~ParentTab() {} |
292 | 294 |
293 void ParentTab::Init(WebContents* web_contents, | 295 void ParentTab::Init(WebContents* web_contents, |
294 const std::string& extension_id) { | 296 const std::string& extension_id) { |
295 CHECK(web_contents); | 297 CHECK(web_contents); |
296 | 298 |
297 extension_id_ = extension_id; | 299 extension_id_ = extension_id; |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 // async case (when a "javascript": URL is sent to a tab). | 841 // async case (when a "javascript": URL is sent to a tab). |
840 if (!is_async) | 842 if (!is_async) |
841 SendResponse(true); | 843 SendResponse(true); |
842 | 844 |
843 return true; | 845 return true; |
844 } | 846 } |
845 | 847 |
846 void UpdateOffscreenTabFunction::PopulateResult() { | 848 void UpdateOffscreenTabFunction::PopulateResult() { |
847 // There's no result associated with this callback. | 849 // There's no result associated with this callback. |
848 } | 850 } |
OLD | NEW |