1bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch#ifndef APPS_LAUNCHER_H_
6bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch#define APPS_LAUNCHER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string>
946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include <vector>
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)class GURL;
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile;
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace base {
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class CommandLine;
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class FilePath;
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace extensions {
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Extension;
21bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch}
22bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch
23bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdochnamespace apps {
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Launches the platform app |extension|. Creates appropriate launch data for
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the |command_line| fields present. |extension| and |profile| must not be
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// NULL. An empty |command_line| means there is no launch data. If non-empty,
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// |current_directory| is used to expand any relative paths on the command line.
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void LaunchPlatformAppWithCommandLine(Profile* profile,
30bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch                                      const extensions::Extension* extension,
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                      const base::CommandLine& command_line,
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                                      const base::FilePath& current_directory);
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Launches the platform app |extension| by issuing an onLaunched event
3558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// with the contents of |file_path| available through the launch data.
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void LaunchPlatformAppWithPath(Profile* profile,
37bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch                               const extensions::Extension* extension,
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                               const base::FilePath& file_path);
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Launches the platform app |extension| with no launch data.
41bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdochvoid LaunchPlatformApp(Profile* profile,
42bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch                       const extensions::Extension* extension);
43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
4458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Launches the platform app |extension| with |handler_id| and the contents of
4546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// |file_paths| available through the launch data. |handler_id| corresponds to
4658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// the id of the file_handlers item in the manifest that resulted in a match
4758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// that triggered this launch.
4846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)void LaunchPlatformAppWithFileHandler(
4946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    Profile* profile,
5046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    const extensions::Extension* extension,
5146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    const std::string& handler_id,
5246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    const std::vector<base::FilePath>& file_paths);
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Launches the platform app |extension| with |handler_id|, |url| and
5558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// |referrer_url| available through the launch data. |handler_id| corresponds to
5658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// the id of the file_handlers item in the manifest that resulted in a match
5758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// that triggered this launch.
5858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)void LaunchPlatformAppWithUrl(Profile* profile,
5958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)                              const extensions::Extension* extension,
6058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)                              const std::string& handler_id,
6158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)                              const GURL& url,
6258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)                              const GURL& referrer_url);
6358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
64bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdochvoid RestartPlatformApp(Profile* profile,
65bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch                        const extensions::Extension* extension);
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
67bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch}  // namespace apps
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
69bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch#endif  // APPS_LAUNCHER_H_
70