Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Side by Side Diff: apps/app_shim/app_shim_handler_mac.h

Issue 585123004: Mac: Give app_shim code a nicer home (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: various cleanups Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « apps/app_shim/app_shim.gypi ('k') | apps/app_shim/app_shim_handler_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #ifndef APPS_APP_SHIM_APP_SHIM_HANDLER_MAC_H_
6 #define APPS_APP_SHIM_APP_SHIM_HANDLER_MAC_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "apps/app_shim/app_shim_launch.h"
12 #include "base/files/file_path.h"
13
14 namespace apps {
15
16 // Registrar, and interface for services that can handle interactions with OSX
17 // shim processes.
18 class AppShimHandler {
19 public:
20 class Host {
21 public:
22 // Invoked when the app is successfully launched.
23 virtual void OnAppLaunchComplete(AppShimLaunchResult result) = 0;
24 // Invoked when the app is closed in the browser process.
25 virtual void OnAppClosed() = 0;
26 // Invoked when the app should be hidden.
27 virtual void OnAppHide() = 0;
28 // Invoked when the app is requesting user attention.
29 virtual void OnAppRequestUserAttention(AppShimAttentionType type) = 0;
30
31 // Allows the handler to determine which app this host corresponds to.
32 virtual base::FilePath GetProfilePath() const = 0;
33 virtual std::string GetAppId() const = 0;
34
35 protected:
36 virtual ~Host() {}
37 };
38
39 // Register a handler for an |app_mode_id|.
40 static void RegisterHandler(const std::string& app_mode_id,
41 AppShimHandler* handler);
42
43 // Remove a handler for an |app_mode_id|.
44 static void RemoveHandler(const std::string& app_mode_id);
45
46 // Returns the handler registered for the given |app_mode_id|. If there is
47 // none registered, it returns the default handler or NULL if there is no
48 // default handler.
49 static AppShimHandler* GetForAppMode(const std::string& app_mode_id);
50
51 // Sets the default handler to return when there is no app-specific handler.
52 // Setting this to NULL removes the default handler.
53 static void SetDefaultHandler(AppShimHandler* handler);
54
55 // Terminate Chrome if a browser window has never been opened, there are no
56 // shell windows, and the app list is not visible.
57 static void MaybeTerminate();
58
59 // Whether browser sessions should be restored right now. This is true if
60 // the browser has been quit but kept alive because Chrome Apps are still
61 // running.
62 static bool ShouldRestoreSession();
63
64 // Invoked by the shim host when the shim process is launched. The handler
65 // must call OnAppLaunchComplete to inform the shim of the result.
66 // |launch_type| indicates the type of launch.
67 // |files|, if non-empty, holds an array of files paths given as arguments, or
68 // dragged onto the app bundle or dock icon.
69 virtual void OnShimLaunch(Host* host,
70 AppShimLaunchType launch_type,
71 const std::vector<base::FilePath>& files) = 0;
72
73 // Invoked by the shim host when the connection to the shim process is closed.
74 virtual void OnShimClose(Host* host) = 0;
75
76 // Invoked by the shim host when the shim process receives a focus event.
77 // |files|, if non-empty, holds an array of files dragged onto the app bundle
78 // or dock icon.
79 virtual void OnShimFocus(Host* host,
80 AppShimFocusType focus_type,
81 const std::vector<base::FilePath>& files) = 0;
82
83 // Invoked by the shim host when the shim process is hidden or shown.
84 virtual void OnShimSetHidden(Host* host, bool hidden) = 0;
85
86 // Invoked by the shim host when the shim process receives a quit event.
87 virtual void OnShimQuit(Host* host) = 0;
88
89 protected:
90 AppShimHandler() {}
91 virtual ~AppShimHandler() {}
92 };
93
94 } // namespace apps
95
96 #endif // APPS_APP_SHIM_APP_SHIM_HANDLER_MAC_H_
OLDNEW
« no previous file with comments | « apps/app_shim/app_shim.gypi ('k') | apps/app_shim/app_shim_handler_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698