| 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 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // TODO: The launch item type should be documented in the idl so that this | 184 // TODO: The launch item type should be documented in the idl so that this |
| 185 // entire function can be strongly typed and built using an | 185 // entire function can be strongly typed and built using an |
| 186 // app_runtime::LaunchData instance. | 186 // app_runtime::LaunchData instance. |
| 187 launch_item->SetString("fileSystemId", file_entries[i].filesystem_id); | 187 launch_item->SetString("fileSystemId", file_entries[i].filesystem_id); |
| 188 launch_item->SetString("baseName", file_entries[i].registered_name); | 188 launch_item->SetString("baseName", file_entries[i].registered_name); |
| 189 launch_item->SetString("mimeType", entries[i].mime_type); | 189 launch_item->SetString("mimeType", entries[i].mime_type); |
| 190 launch_item->SetString("entryId", file_entries[i].id); | 190 launch_item->SetString("entryId", file_entries[i].id); |
| 191 launch_item->SetBoolean("isDirectory", entries[i].is_directory); | 191 launch_item->SetBoolean("isDirectory", entries[i].is_directory); |
| 192 items->Append(std::move(launch_item)); | 192 items->Append(std::move(launch_item)); |
| 193 } | 193 } |
| 194 launch_data->Set("items", items.release()); | 194 launch_data->Set("items", std::move(items)); |
| 195 DispatchOnLaunchedEventImpl(extension->id(), source_enum, | 195 DispatchOnLaunchedEventImpl(extension->id(), source_enum, |
| 196 std::move(launch_data), context); | 196 std::move(launch_data), context); |
| 197 } | 197 } |
| 198 | 198 |
| 199 // static | 199 // static |
| 200 void AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( | 200 void AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( |
| 201 BrowserContext* context, | 201 BrowserContext* context, |
| 202 const Extension* extension, | 202 const Extension* extension, |
| 203 const std::string& handler_id, | 203 const std::string& handler_id, |
| 204 const GURL& url, | 204 const GURL& url, |
| 205 const GURL& referrer_url) { | 205 const GURL& referrer_url) { |
| 206 app_runtime::LaunchData launch_data; | 206 app_runtime::LaunchData launch_data; |
| 207 app_runtime::LaunchSource source_enum = | 207 app_runtime::LaunchSource source_enum = |
| 208 app_runtime::LAUNCH_SOURCE_URL_HANDLER; | 208 app_runtime::LAUNCH_SOURCE_URL_HANDLER; |
| 209 launch_data.id.reset(new std::string(handler_id)); | 209 launch_data.id.reset(new std::string(handler_id)); |
| 210 launch_data.url.reset(new std::string(url.spec())); | 210 launch_data.url.reset(new std::string(url.spec())); |
| 211 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); | 211 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); |
| 212 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { | 212 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { |
| 213 launch_data.source = source_enum; | 213 launch_data.source = source_enum; |
| 214 } | 214 } |
| 215 DispatchOnLaunchedEventImpl(extension->id(), source_enum, | 215 DispatchOnLaunchedEventImpl(extension->id(), source_enum, |
| 216 launch_data.ToValue(), context); | 216 launch_data.ToValue(), context); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace extensions | 219 } // namespace extensions |
| OLD | NEW |