12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Multiply-included message file, hence no include guard. 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string> 858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include <vector> 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/files/file_path.h" 111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "chrome/common/mac/app_shim_launch.h" 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ipc/ipc_message_macros.h" 1358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "ipc/ipc_message_utils.h" 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ipc/param_traits_macros.h" 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define IPC_MESSAGE_START AppShimMsgStart 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 18eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen MurdochIPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchType, 19eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch apps::APP_SHIM_LAUNCH_NUM_TYPES - 1) 207dbb3d5cf0c15f500944d211057644d6a2f37371Ben MurdochIPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchResult, 217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch apps::APP_SHIM_LAUNCH_NUM_RESULTS - 1) 22eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen MurdochIPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimFocusType, 23eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch apps::APP_SHIM_FOCUS_NUM_TYPES - 1) 2403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimAttentionType, 2503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) apps::APP_SHIM_ATTENTION_NUM_TYPES - 1) 2603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 2703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// IMPORTANT: Since app shims could be running a newer framework version to the 2803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// currently running Chrome, any changes to these IPCs must maintain the same 2903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// order and format. I.e. Only add to the bottom, don't delete any. 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Signals that a previous LaunchApp message has been processed, and lets the 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// app shim process know whether it was registered successfully. 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)IPC_MESSAGE_CONTROL1(AppShimMsg_LaunchApp_Done, 347dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch apps::AppShimLaunchResult /* launch result */) 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Instructs the shim to hide the app. 3758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)IPC_MESSAGE_CONTROL0(AppShimMsg_Hide) 3858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 3903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Deprecated. Do not delete. 40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)IPC_MESSAGE_CONTROL0(AppShimMsg_RequestUserAttention) 41424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 4203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Signals to the main Chrome process that a shim has started. Indicates the 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// profile and app_id that the shim should be associated with and whether to 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// launch the app immediately. 4558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)IPC_MESSAGE_CONTROL4(AppShimHostMsg_LaunchApp, 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::FilePath /* profile dir */, 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::string /* app id */, 4858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) apps::AppShimLaunchType /* launch type */, 4958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) std::vector<base::FilePath> /* files */) 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Sent when the user has indicated a desire to focus the app, either by 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// clicking on the app's icon in the dock or by selecting it with Cmd+Tab. In 53eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// response, Chrome brings the app's windows to the foreground, or relaunches 54eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// if the focus type indicates a reopen and there are no open windows. 5558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)IPC_MESSAGE_CONTROL2(AppShimHostMsg_FocusApp, 5658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) apps::AppShimFocusType /* focus type */, 5758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) std::vector<base::FilePath> /* files */) 58eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 59eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// Sent when the app shim is hidden or unhidden. 60eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen MurdochIPC_MESSAGE_CONTROL1(AppShimHostMsg_SetAppHidden, 61eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch bool /* hidden */) 62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Sent when the shim process receives a request to terminate. Once all of the 64868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// app's windows have closed, and the extension is unloaded, the AppShimHost 65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// closes the channel. The shim process then completes the terminate request 66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// and exits. 67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)IPC_MESSAGE_CONTROL0(AppShimHostMsg_QuitApp) 6803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 6903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)// Instructs the shim to request or cancel user attention. 7003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)IPC_MESSAGE_CONTROL1(AppShimMsg_SetUserAttention, 7103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) apps::AppShimAttentionType /* attention_type */) 72