Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: extensions/browser/api/app_runtime/app_runtime_api.cc

Issue 2272813003: Add ARC++ specific fields to launch data for specific apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: chrome build fix. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "extensions/browser/entry_info.h" 15 #include "extensions/browser/entry_info.h"
15 #include "extensions/browser/event_router.h" 16 #include "extensions/browser/event_router.h"
16 #include "extensions/browser/extension_prefs.h" 17 #include "extensions/browser/extension_prefs.h"
17 #include "extensions/browser/extensions_browser_client.h" 18 #include "extensions/browser/extensions_browser_client.h"
18 #include "extensions/browser/granted_file_entry.h" 19 #include "extensions/browser/granted_file_entry.h"
19 #include "extensions/common/api/app_runtime.h" 20 #include "extensions/common/api/app_runtime.h"
20 #include "extensions/common/constants.h" 21 #include "extensions/common/constants.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const Extension* extension) { 132 const Extension* extension) {
132 DispatchOnEmbedRequestedEventImpl(extension->id(), std::move(embed_app_data), 133 DispatchOnEmbedRequestedEventImpl(extension->id(), std::move(embed_app_data),
133 context); 134 context);
134 } 135 }
135 136
136 // static 137 // static
137 void AppRuntimeEventRouter::DispatchOnLaunchedEvent( 138 void AppRuntimeEventRouter::DispatchOnLaunchedEvent(
138 BrowserContext* context, 139 BrowserContext* context,
139 const Extension* extension, 140 const Extension* extension,
140 extensions::AppLaunchSource source, 141 extensions::AppLaunchSource source,
141 std::unique_ptr<app_runtime::ActionData> action_data) { 142 std::unique_ptr<app_runtime::LaunchData> launch_data) {
142 app_runtime::LaunchData launch_data; 143 if (!launch_data)
143 144 launch_data = base::MakeUnique<app_runtime::LaunchData>();
144 app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source); 145 app_runtime::LaunchSource source_enum = GetLaunchSourceEnum(source);
145 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { 146 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) {
146 launch_data.source = source_enum; 147 launch_data->source = source_enum;
147 } 148 }
148 149
149 launch_data.action_data = std::move(action_data);
150
151 DispatchOnLaunchedEventImpl(extension->id(), source_enum, 150 DispatchOnLaunchedEventImpl(extension->id(), source_enum,
152 launch_data.ToValue(), context); 151 launch_data->ToValue(), context);
153 } 152 }
154 153
155 // static 154 // static
156 void AppRuntimeEventRouter::DispatchOnRestartedEvent( 155 void AppRuntimeEventRouter::DispatchOnRestartedEvent(
157 BrowserContext* context, 156 BrowserContext* context,
158 const Extension* extension) { 157 const Extension* extension) {
159 std::unique_ptr<base::ListValue> arguments(new base::ListValue()); 158 std::unique_ptr<base::ListValue> arguments(new base::ListValue());
160 std::unique_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED, 159 std::unique_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED,
161 app_runtime::OnRestarted::kEventName, 160 app_runtime::OnRestarted::kEventName,
162 std::move(arguments))); 161 std::move(arguments)));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 launch_data.url.reset(new std::string(url.spec())); 222 launch_data.url.reset(new std::string(url.spec()));
224 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); 223 launch_data.referrer_url.reset(new std::string(referrer_url.spec()));
225 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { 224 if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) {
226 launch_data.source = source_enum; 225 launch_data.source = source_enum;
227 } 226 }
228 DispatchOnLaunchedEventImpl(extension->id(), source_enum, 227 DispatchOnLaunchedEventImpl(extension->id(), source_enum,
229 launch_data.ToValue(), context); 228 launch_data.ToValue(), context);
230 } 229 }
231 230
232 } // namespace extensions 231 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/app_runtime/app_runtime_api.h ('k') | extensions/common/api/app_runtime.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698