File: app_launch_params.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (124 lines) | stat: -rw-r--r-- 4,427 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_APPS_APP_SERVICE_APP_LAUNCH_PARAMS_H_
#define CHROME_BROWSER_APPS_APP_SERVICE_APP_LAUNCH_PARAMS_H_

#include <stdint.h>

#include <optional>
#include <string>
#include <vector>

#include "base/command_line.h"
#include "base/files/file_path.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/services/app_service/public/cpp/intent.h"
#include "ui/base/window_open_disposition.h"
#include "ui/display/types/display_constants.h"
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"

namespace apps {

struct AppLaunchParams {
  AppLaunchParams(const std::string& app_id,
                  LaunchContainer container,
                  WindowOpenDisposition disposition,
                  apps::LaunchSource launch_source,
                  int64_t display_id = display::kInvalidDisplayId);

  AppLaunchParams(const std::string& app_id,
                  LaunchContainer container,
                  WindowOpenDisposition disposition,
                  apps::LaunchSource launch_source,
                  int64_t display_id,
                  const std::vector<base::FilePath>& files,
                  const IntentPtr& intentPtr);

  AppLaunchParams(const std::string& app_id,
                  LaunchContainer container,
                  WindowOpenDisposition disposition,
                  const GURL& override_url,
                  apps::LaunchSource launch_source,
                  int64_t display_id,
                  const std::vector<base::FilePath>& files,
                  const IntentPtr& intentPtr);

  AppLaunchParams(const AppLaunchParams&) = delete;
  AppLaunchParams& operator=(const AppLaunchParams&) = delete;
  AppLaunchParams(AppLaunchParams&&);
  AppLaunchParams& operator=(AppLaunchParams&&);

  ~AppLaunchParams();

  // The app to launch.
  std::string app_id;

  // An id that can be passed to an app when launched in order to support
  // multiple shelf items per app.
  std::string launch_id;

  // The container type to launch the application in.
  LaunchContainer container;

  // If container is TAB, this field controls how the tab is opened.
  // If container is WINDOW, NEW_WINDOW will force a new window to be opened.
  WindowOpenDisposition disposition;

  // If non-empty, use override_url in place of the application's launch url.
  GURL override_url;

  // If non-empty, use override_boudns in place of the application's default
  // position and dimensions.
  gfx::Rect override_bounds;

  // If non-empty, use override_app_name in place of generating one normally.
  std::string override_app_name;

  // The id from the restore data to restore the browser window.
  int32_t restore_id = 0;

  // If non-empty, information from the command line may be passed on to the
  // application.
  base::CommandLine command_line;

  // If non-empty, the current directory from which any relative paths on the
  // command line should be expanded from.
  base::FilePath current_directory;

  // Record where the app is launched from for tracking purpose.
  // Different app may have their own enumeration of sources.
  apps::LaunchSource launch_source;

  // The id of the display from which the app is launched.
  // display::kInvalidDisplayId means that the default display for new windows
  // will be used. See `display::Screen` for details.
  int64_t display_id;

  // The files the application was launched with. Empty if the application was
  // not launched with files.
  std::vector<base::FilePath> launch_files;

  // The intent the application was launched with. Empty if the application was
  // not launched with intent.
  IntentPtr intent;

  // When PWA is launched as a URL handler, the URL that we should launch the
  // PWA to. Null when it's not a URL handler launch.
  std::optional<GURL> url_handler_launch_url;

  // When a PWA is launched as a protocol handler, the protocol URL that we
  // should translate and then launch the PWA to. Null when it's not a protocol
  // handler launch.
  std::optional<GURL> protocol_handler_launch_url;

  // Whether or not to have the resulting Browser be omitted from session
  // restore.
  bool omit_from_session_restore = false;
};

}  // namespace apps

#endif  // CHROME_BROWSER_APPS_APP_SERVICE_APP_LAUNCH_PARAMS_H_