Home | History | Annotate | Download | only in app_shim
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Multiply-included message file, hence no include guard.
      6 
      7 #include <string>
      8 #include <vector>
      9 
     10 #include "apps/app_shim/app_shim_launch.h"
     11 #include "base/files/file_path.h"
     12 #include "ipc/ipc_message_macros.h"
     13 #include "ipc/ipc_message_utils.h"
     14 #include "ipc/param_traits_macros.h"
     15 
     16 #define IPC_MESSAGE_START AppShimMsgStart
     17 
     18 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchType,
     19                           apps::APP_SHIM_LAUNCH_NUM_TYPES - 1)
     20 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchResult,
     21                           apps::APP_SHIM_LAUNCH_NUM_RESULTS - 1)
     22 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimFocusType,
     23                           apps::APP_SHIM_FOCUS_NUM_TYPES - 1)
     24 
     25 // Signals that a previous LaunchApp message has been processed, and lets the
     26 // app shim process know whether it was registered successfully.
     27 IPC_MESSAGE_CONTROL1(AppShimMsg_LaunchApp_Done,
     28                      apps::AppShimLaunchResult /* launch result */)
     29 
     30 // Instructs the shim to hide the app.
     31 IPC_MESSAGE_CONTROL0(AppShimMsg_Hide)
     32 
     33 // Instructs the shim to request user attention.
     34 IPC_MESSAGE_CONTROL0(AppShimMsg_RequestUserAttention)
     35 
     36 // Signals to the main Chrome process that a shim has started indicating the
     37 // profile and app_id that the shim should be associated with and whether to
     38 // launch the app immediately.
     39 IPC_MESSAGE_CONTROL4(AppShimHostMsg_LaunchApp,
     40                      base::FilePath /* profile dir */,
     41                      std::string /* app id */,
     42                      apps::AppShimLaunchType /* launch type */,
     43                      std::vector<base::FilePath> /* files */)
     44 
     45 // Sent when the user has indicated a desire to focus the app, either by
     46 // clicking on the app's icon in the dock or by selecting it with Cmd+Tab. In
     47 // response, Chrome brings the app's windows to the foreground, or relaunches
     48 // if the focus type indicates a reopen and there are no open windows.
     49 IPC_MESSAGE_CONTROL2(AppShimHostMsg_FocusApp,
     50                      apps::AppShimFocusType /* focus type */,
     51                      std::vector<base::FilePath> /* files */)
     52 
     53 // Sent when the app shim is hidden or unhidden.
     54 IPC_MESSAGE_CONTROL1(AppShimHostMsg_SetAppHidden,
     55                      bool /* hidden */)
     56 
     57 // Sent when the shim process receives a request to terminate. Once all of the
     58 // app's windows have closed, and the extension is unloaded, the AppShimHost
     59 // closes the channel. The shim process then completes the terminate request
     60 // and exits.
     61 IPC_MESSAGE_CONTROL0(AppShimHostMsg_QuitApp)
     62