OLD | NEW |
---|---|
(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 CHROME_BROWSER_WEB_APPLICATIONS_EXTENSION_APP_SHIM_HANDLER_H_ | |
tapted
2013/05/21 06:15:37
(if it stays here) include guard needs updating
jackhou1
2013/05/22 23:54:44
Done.
| |
6 #define CHROME_BROWSER_WEB_APPLICATIONS_EXTENSION_APP_SHIM_HANDLER_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "apps/app_shim/app_shim_handler_mac.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/observer_list.h" | |
14 #include "base/threading/non_thread_safe.h" | |
15 #include "content/public/browser/notification_observer.h" | |
16 #include "content/public/browser/notification_registrar.h" | |
17 #include "ipc/ipc_listener.h" | |
tapted
2013/05/21 06:15:37
The IPC includes shouldn't be needed here. It look
jackhou1
2013/05/22 23:54:44
Done.
| |
18 #include "ipc/ipc_sender.h" | |
19 | |
20 class Profile; | |
21 | |
22 // This app shim handler that handles events for app shims that correspond to an | |
23 // extension. | |
24 class ExtensionAppShimHandler : public apps::AppShimHandler, | |
tapted
2013/05/21 06:15:37
(if it stays here) can be namespace apps
jackhou1
2013/05/22 23:54:44
Done.
| |
25 public content::NotificationObserver, | |
26 public base::NonThreadSafe { | |
tapted
2013/05/21 06:15:37
We can probably drop NonThreadSafe (and the Called
jackhou1
2013/05/22 23:54:44
Done.
| |
27 public: | |
28 ExtensionAppShimHandler(); | |
29 virtual ~ExtensionAppShimHandler(); | |
30 | |
31 // Methods from AppShimHandler. | |
tapted
2013/05/21 06:15:37
nit: "AppShimHandler overrides:" is the usual temp
jackhou1
2013/05/22 23:54:44
Done.
| |
32 virtual bool OnShimLaunch(Host* host) OVERRIDE; | |
33 virtual void OnShimClose(Host* host) OVERRIDE; | |
34 virtual void OnShimFocus(Host* host) OVERRIDE; | |
35 | |
36 protected: | |
37 typedef std::map<std::pair<Profile*, std::string>, | |
38 ObserverList<apps::AppShimHandler::Host>* > HostMap; | |
39 | |
40 HostMap::mapped_type GetObserverList(Profile* profile, | |
41 const std::string& app_id, | |
42 bool create_if_not_exist); | |
43 | |
44 content::NotificationRegistrar registrar_; | |
tapted
2013/05/21 06:15:37
data members must be private (unless it's a test f
jackhou1
2013/05/22 23:54:44
Done.
| |
45 | |
46 private: | |
47 virtual bool LaunchApp(Profile* profile, const std::string& app_id); | |
48 | |
49 // Listen to the NOTIFICATION_EXTENSION_HOST_DESTROYED message to detect when | |
50 // an app closes. When that happens, call OnAppClosed on the relevant | |
51 // AppShimHandler::Host which causes the app shim process to quit. | |
52 // The host will call OnShimClose on this. | |
53 virtual void Observe(int type, | |
54 const content::NotificationSource& source, | |
55 const content::NotificationDetails& details) OVERRIDE; | |
56 | |
57 void Close(Profile* profile, const std::string& app_id); | |
58 | |
59 HostMap hosts_; | |
60 }; | |
61 | |
62 #endif // CHROME_BROWSER_WEB_APPLICATIONS_EXTENSION_APP_SHIM_HANDLER_H_ | |
OLD | NEW |