(Patch by Teodora Novkovic <teodora.petrovic@gmail.com>, originally reviewed at ...
[chromium-blink-merge.git] / apps / app_shim / app_shim_handler_mac.h
blob6a694c0a0a3107e88e106229af8cc7bf3d4be880
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.
5 #ifndef APPS_APP_SHIM_APP_SHIM_HANDLER_MAC_H_
6 #define APPS_APP_SHIM_APP_SHIM_HANDLER_MAC_H_
8 #include <string>
10 namespace apps {
12 // Registrar, and interface for services that can handle interactions with OSX
13 // shim processes.
14 class AppShimHandler {
15 public:
16 class Host {
17 public:
18 // Invoked when the app is closed in the browser process.
19 virtual void OnAppClosed() = 0;
21 protected:
22 virtual ~Host() {}
25 // Register a handler for an |app_mode_id|.
26 static void RegisterHandler(const std::string& app_mode_id,
27 AppShimHandler* handler);
29 // Remove a handler for an |app_mode_id|.
30 static void RemoveHandler(const std::string& app_mode_id);
32 // Returns the handler registered for the given |app_mode_id|, or NULL if none
33 // is registered.
34 static AppShimHandler* GetForAppMode(const std::string& app_mode_id);
36 // Invoked by the shim host when the shim process is launched. The handler
37 // must return true if successful, or false to indicate back to the shim
38 // process that it should close.
39 virtual bool OnShimLaunch(Host* host) = 0;
41 // Invoked by the shim host when the connection to the shim process is closed.
42 virtual void OnShimClose(Host* host) = 0;
44 // Invoked by the shim host when the shim process receives a focus event.
45 virtual void OnShimFocus(Host* host) = 0;
47 protected:
48 AppShimHandler() {}
49 virtual ~AppShimHandler() {}
52 } // namespace apps
54 #endif // APPS_APP_SHIM_APP_SHIM_HANDLER_MAC_H_