| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 // Multiply-included message file, hence no include guard. | 5 // Multiply-included message file, hence no include guard. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/app_shim/app_shim_launch.h" | 10 #include "apps/app_shim/app_shim_launch.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
| 13 #include "ipc/ipc_message_utils.h" | 13 #include "ipc/ipc_message_utils.h" |
| 14 #include "ipc/param_traits_macros.h" | 14 #include "ipc/param_traits_macros.h" |
| 15 | 15 |
| 16 #define IPC_MESSAGE_START AppShimMsgStart | 16 #define IPC_MESSAGE_START AppShimMsgStart |
| 17 | 17 |
| 18 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchType, | 18 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchType, |
| 19 apps::APP_SHIM_LAUNCH_NUM_TYPES - 1) | 19 apps::APP_SHIM_LAUNCH_NUM_TYPES - 1) |
| 20 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchResult, | 20 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimLaunchResult, |
| 21 apps::APP_SHIM_LAUNCH_NUM_RESULTS - 1) | 21 apps::APP_SHIM_LAUNCH_NUM_RESULTS - 1) |
| 22 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimFocusType, | 22 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimFocusType, |
| 23 apps::APP_SHIM_FOCUS_NUM_TYPES - 1) | 23 apps::APP_SHIM_FOCUS_NUM_TYPES - 1) |
| 24 IPC_ENUM_TRAITS_MAX_VALUE(apps::AppShimAttentionType, |
| 25 apps::APP_SHIM_ATTENTION_NUM_TYPES - 1) |
| 26 |
| 27 // IMPORTANT: Since app shims could be running a newer framework version to the |
| 28 // currently running Chrome, any changes to these IPCs must maintain the same |
| 29 // order and format. I.e. Only add to the bottom, don't delete any. |
| 24 | 30 |
| 25 // Signals that a previous LaunchApp message has been processed, and lets the | 31 // Signals that a previous LaunchApp message has been processed, and lets the |
| 26 // app shim process know whether it was registered successfully. | 32 // app shim process know whether it was registered successfully. |
| 27 IPC_MESSAGE_CONTROL1(AppShimMsg_LaunchApp_Done, | 33 IPC_MESSAGE_CONTROL1(AppShimMsg_LaunchApp_Done, |
| 28 apps::AppShimLaunchResult /* launch result */) | 34 apps::AppShimLaunchResult /* launch result */) |
| 29 | 35 |
| 30 // Instructs the shim to hide the app. | 36 // Instructs the shim to hide the app. |
| 31 IPC_MESSAGE_CONTROL0(AppShimMsg_Hide) | 37 IPC_MESSAGE_CONTROL0(AppShimMsg_Hide) |
| 32 | 38 |
| 33 // Instructs the shim to request user attention. | 39 // Deprecated. Do not delete. |
| 34 IPC_MESSAGE_CONTROL0(AppShimMsg_RequestUserAttention) | 40 IPC_MESSAGE_CONTROL0(AppShimMsg_RequestUserAttention) |
| 35 | 41 |
| 36 // Signals to the main Chrome process that a shim has started indicating the | 42 // Signals to the main Chrome process that a shim has started. Indicates the |
| 37 // profile and app_id that the shim should be associated with and whether to | 43 // profile and app_id that the shim should be associated with and whether to |
| 38 // launch the app immediately. | 44 // launch the app immediately. |
| 39 IPC_MESSAGE_CONTROL4(AppShimHostMsg_LaunchApp, | 45 IPC_MESSAGE_CONTROL4(AppShimHostMsg_LaunchApp, |
| 40 base::FilePath /* profile dir */, | 46 base::FilePath /* profile dir */, |
| 41 std::string /* app id */, | 47 std::string /* app id */, |
| 42 apps::AppShimLaunchType /* launch type */, | 48 apps::AppShimLaunchType /* launch type */, |
| 43 std::vector<base::FilePath> /* files */) | 49 std::vector<base::FilePath> /* files */) |
| 44 | 50 |
| 45 // Sent when the user has indicated a desire to focus the app, either by | 51 // 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 | 52 // 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 | 53 // 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. | 54 // if the focus type indicates a reopen and there are no open windows. |
| 49 IPC_MESSAGE_CONTROL2(AppShimHostMsg_FocusApp, | 55 IPC_MESSAGE_CONTROL2(AppShimHostMsg_FocusApp, |
| 50 apps::AppShimFocusType /* focus type */, | 56 apps::AppShimFocusType /* focus type */, |
| 51 std::vector<base::FilePath> /* files */) | 57 std::vector<base::FilePath> /* files */) |
| 52 | 58 |
| 53 // Sent when the app shim is hidden or unhidden. | 59 // Sent when the app shim is hidden or unhidden. |
| 54 IPC_MESSAGE_CONTROL1(AppShimHostMsg_SetAppHidden, | 60 IPC_MESSAGE_CONTROL1(AppShimHostMsg_SetAppHidden, |
| 55 bool /* hidden */) | 61 bool /* hidden */) |
| 56 | 62 |
| 57 // Sent when the shim process receives a request to terminate. Once all of the | 63 // 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 | 64 // app's windows have closed, and the extension is unloaded, the AppShimHost |
| 59 // closes the channel. The shim process then completes the terminate request | 65 // closes the channel. The shim process then completes the terminate request |
| 60 // and exits. | 66 // and exits. |
| 61 IPC_MESSAGE_CONTROL0(AppShimHostMsg_QuitApp) | 67 IPC_MESSAGE_CONTROL0(AppShimHostMsg_QuitApp) |
| 68 |
| 69 // Instructs the shim to request or cancel user attention. |
| 70 IPC_MESSAGE_CONTROL1(AppShimMsg_SetUserAttention, |
| 71 apps::AppShimAttentionType /* attention_type */) |
| OLD | NEW |