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/platform_app_launcher.h" | 5 #include "chrome/browser/extensions/platform_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "content/public/browser/child_process_security_policy.h" | 23 #include "content/public/browser/child_process_security_policy.h" |
24 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
25 #include "net/base/mime_util.h" | 25 #include "net/base/mime_util.h" |
26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
27 #include "webkit/fileapi/file_system_types.h" | 27 #include "webkit/fileapi/file_system_types.h" |
28 #include "webkit/fileapi/isolated_context.h" | 28 #include "webkit/fileapi/isolated_context.h" |
29 #include "webkit/glue/web_intent_data.h" | 29 #include "webkit/glue/web_intent_data.h" |
30 #include "webkit/glue/web_intent_service_data.h" | 30 #include "webkit/glue/web_intent_service_data.h" |
31 | 31 |
32 using content::BrowserThread; | 32 using content::BrowserThread; |
33 using extensions::Extension; | 33 |
34 using extensions::ExtensionSystem; | 34 namespace extensions { |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 const char kViewIntent[] = "http://webintents.org/view"; | 38 const char kViewIntent[] = "http://webintents.org/view"; |
39 | 39 |
40 bool MakePathAbsolute(const FilePath& current_directory, | 40 bool MakePathAbsolute(const FilePath& current_directory, |
41 FilePath* file_path) { | 41 FilePath* file_path) { |
42 DCHECK(file_path); | 42 DCHECK(file_path); |
43 if (file_path->IsAbsolute()) | 43 if (file_path->IsAbsolute()) |
44 return true; | 44 return true; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // The extension providing the app. | 298 // The extension providing the app. |
299 const Extension* extension_; | 299 const Extension* extension_; |
300 // The WebIntent data to be passed through to the app. | 300 // The WebIntent data to be passed through to the app. |
301 const webkit_glue::WebIntentData data_; | 301 const webkit_glue::WebIntentData data_; |
302 | 302 |
303 DISALLOW_COPY_AND_ASSIGN(PlatformAppBlobIntentLauncher); | 303 DISALLOW_COPY_AND_ASSIGN(PlatformAppBlobIntentLauncher); |
304 }; | 304 }; |
305 | 305 |
306 } // namespace | 306 } // namespace |
307 | 307 |
308 namespace extensions { | |
309 | |
310 void LaunchPlatformApp(Profile* profile, | 308 void LaunchPlatformApp(Profile* profile, |
311 const Extension* extension, | 309 const Extension* extension, |
312 const CommandLine* command_line, | 310 const CommandLine* command_line, |
313 const FilePath& current_directory) { | 311 const FilePath& current_directory) { |
314 // launcher will be freed when nothing has a reference to it. The message | 312 // launcher will be freed when nothing has a reference to it. The message |
315 // queue will retain a reference for any outstanding task, so when the | 313 // queue will retain a reference for any outstanding task, so when the |
316 // launcher has finished it will be freed. | 314 // launcher has finished it will be freed. |
317 scoped_refptr<PlatformAppCommandLineLauncher> launcher = | 315 scoped_refptr<PlatformAppCommandLineLauncher> launcher = |
318 new PlatformAppCommandLineLauncher(profile, extension, command_line, | 316 new PlatformAppCommandLineLauncher(profile, extension, command_line, |
319 current_directory); | 317 current_directory); |
320 launcher->Launch(); | 318 launcher->Launch(); |
321 } | 319 } |
322 | 320 |
323 void LaunchPlatformAppWithWebIntent( | 321 void LaunchPlatformAppWithWebIntent( |
324 Profile* profile, | 322 Profile* profile, |
325 const Extension* extension, | 323 const Extension* extension, |
326 const webkit_glue::WebIntentData& web_intent_data) { | 324 const webkit_glue::WebIntentData& web_intent_data) { |
327 if (web_intent_data.data_type == webkit_glue::WebIntentData::BLOB) { | 325 if (web_intent_data.data_type == webkit_glue::WebIntentData::BLOB) { |
328 scoped_refptr<PlatformAppBlobIntentLauncher> launcher = | 326 scoped_refptr<PlatformAppBlobIntentLauncher> launcher = |
329 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); | 327 new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); |
330 launcher->Launch(); | 328 launcher->Launch(); |
331 return; | 329 return; |
332 } | 330 } |
333 | 331 |
334 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( | 332 extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( |
335 profile, extension, web_intent_data); | 333 profile, extension, web_intent_data); |
336 } | 334 } |
337 | 335 |
338 } // namespace extensions | 336 } // namespace extensions |
OLD | NEW |