OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/app_runtime/app_runtime_api.h" | 5 #include "extensions/browser/api/app_runtime/app_runtime_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/memory/ptr_util.h" | |
12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
14 #include "base/values.h" | 13 #include "base/values.h" |
15 #include "extensions/browser/entry_info.h" | 14 #include "extensions/browser/entry_info.h" |
16 #include "extensions/browser/event_router.h" | 15 #include "extensions/browser/event_router.h" |
17 #include "extensions/browser/extension_prefs.h" | 16 #include "extensions/browser/extension_prefs.h" |
18 #include "extensions/browser/extensions_browser_client.h" | 17 #include "extensions/browser/extensions_browser_client.h" |
19 #include "extensions/browser/granted_file_entry.h" | 18 #include "extensions/browser/granted_file_entry.h" |
20 #include "extensions/common/api/app_runtime.h" | 19 #include "extensions/common/api/app_runtime.h" |
21 #include "extensions/common/constants.h" | 20 #include "extensions/common/constants.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 const Extension* extension) { | 131 const Extension* extension) { |
133 DispatchOnEmbedRequestedEventImpl(extension->id(), std::move(embed_app_data), | 132 DispatchOnEmbedRequestedEventImpl(extension->id(), std::move(embed_app_data), |
134 context); | 133 context); |
135 } | 134 } |
136 | 135 |
137 // static | 136 // static |
138 void AppRuntimeEventRouter::DispatchOnLaunchedEvent( | 137 void AppRuntimeEventRouter::DispatchOnLaunchedEvent( |
139 BrowserContext* context, | 138 BrowserContext* context, |
140 const Extension* extension, | 139 const Extension* extension, |
141 extensions::AppLaunchSource source, | 140 extensions::AppLaunchSource source, |
142 std::unique_ptr<app_runtime::LaunchData> launch_data) { | 141 std::unique_ptr<app_runtime::ActionData> action_data) { |
143 if (!launch_data) | 142 app_runtime::LaunchData launch_data; |
144 launch_data = base::MakeUnique<app_runtime::LaunchData>(); | 143 |
145 app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source); | 144 app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source); |
146 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { | 145 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { |
147 launch_data->source = source_enum; | 146 launch_data.source = source_enum; |
148 } | 147 } |
149 | 148 |
| 149 launch_data.action_data = std::move(action_data); |
| 150 |
150 DispatchOnLaunchedEventImpl(extension->id(), source_enum, | 151 DispatchOnLaunchedEventImpl(extension->id(), source_enum, |
151 launch_data->ToValue(), context); | 152 launch_data.ToValue(), context); |
152 } | 153 } |
153 | 154 |
154 // static | 155 // static |
155 void AppRuntimeEventRouter::DispatchOnRestartedEvent( | 156 void AppRuntimeEventRouter::DispatchOnRestartedEvent( |
156 BrowserContext* context, | 157 BrowserContext* context, |
157 const Extension* extension) { | 158 const Extension* extension) { |
158 std::unique_ptr<base::ListValue> arguments(new base::ListValue()); | 159 std::unique_ptr<base::ListValue> arguments(new base::ListValue()); |
159 std::unique_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED, | 160 std::unique_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED, |
160 app_runtime::OnRestarted::kEventName, | 161 app_runtime::OnRestarted::kEventName, |
161 std::move(arguments))); | 162 std::move(arguments))); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 launch_data.url.reset(new std::string(url.spec())); | 223 launch_data.url.reset(new std::string(url.spec())); |
223 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); | 224 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); |
224 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { | 225 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { |
225 launch_data.source = source_enum; | 226 launch_data.source = source_enum; |
226 } | 227 } |
227 DispatchOnLaunchedEventImpl(extension->id(), source_enum, | 228 DispatchOnLaunchedEventImpl(extension->id(), source_enum, |
228 launch_data.ToValue(), context); | 229 launch_data.ToValue(), context); |
229 } | 230 } |
230 | 231 |
231 } // namespace extensions | 232 } // namespace extensions |
OLD | NEW |