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

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

Issue 14579006: Start app shim when app launched. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « apps/app_shim/app_shim_messages.h ('k') | apps/app_shim/extension_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
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 #ifndef APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_ 5 #ifndef APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_
6 #define APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_ 6 #define APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "apps/app_shim/app_shim_handler_mac.h" 11 #include "apps/app_shim/app_shim_handler_mac.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 14
15 class Profile; 15 class Profile;
16 16
17 namespace extensions {
18 class Extension;
19 }
20
17 namespace apps { 21 namespace apps {
18 22
19 // This app shim handler that handles events for app shims that correspond to an 23 // This app shim handler that handles events for app shims that correspond to an
20 // extension. 24 // extension.
21 class ExtensionAppShimHandler : public AppShimHandler, 25 class ExtensionAppShimHandler : public AppShimHandler,
22 public content::NotificationObserver { 26 public content::NotificationObserver {
23 public: 27 public:
24 ExtensionAppShimHandler(); 28 ExtensionAppShimHandler();
25 virtual ~ExtensionAppShimHandler(); 29 virtual ~ExtensionAppShimHandler();
26 30
27 // AppShimHandler overrides: 31 // AppShimHandler overrides:
28 virtual bool OnShimLaunch(Host* host) OVERRIDE; 32 virtual bool OnShimLaunch(Host* host, AppShimLaunchType launch_type) OVERRIDE;
29 virtual void OnShimClose(Host* host) OVERRIDE; 33 virtual void OnShimClose(Host* host) OVERRIDE;
30 virtual void OnShimFocus(Host* host) OVERRIDE; 34 virtual void OnShimFocus(Host* host) OVERRIDE;
31 virtual void OnShimQuit(Host* host) OVERRIDE; 35 virtual void OnShimQuit(Host* host) OVERRIDE;
32 36
33 protected: 37 protected:
34 typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*> 38 typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*>
35 HostMap; 39 HostMap;
36 40
37 // Exposed for testing. 41 // Exposed for testing.
38 HostMap& hosts() { return hosts_; } 42 HostMap& hosts() { return hosts_; }
39 content::NotificationRegistrar& registrar() { return registrar_; } 43 content::NotificationRegistrar& registrar() { return registrar_; }
40 44
41 private: 45 private:
42 virtual bool LaunchApp(Profile* profile, const std::string& app_id); 46 virtual bool LaunchApp(Profile* profile,
47 const std::string& app_id,
48 AppShimLaunchType launch_type);
43 49
44 // Listen to the NOTIFICATION_EXTENSION_HOST_DESTROYED message to detect when 50 // Listen to the NOTIFICATION_EXTENSION_HOST_DESTROYED message to detect when
45 // an app closes. When that happens, call OnAppClosed on the relevant 51 // an app closes. When that happens, call OnAppClosed on the relevant
46 // AppShimHandler::Host which causes the app shim process to quit. 52 // AppShimHandler::Host which causes the app shim process to quit.
47 // The host will call OnShimClose on this. 53 // The host will call OnShimClose on this.
48 virtual void Observe(int type, 54 virtual void Observe(int type,
49 const content::NotificationSource& source, 55 const content::NotificationSource& source,
50 const content::NotificationDetails& details) OVERRIDE; 56 const content::NotificationDetails& details) OVERRIDE;
51 57
58 void StartShim(Profile* profile, const extensions::Extension* extension);
59
52 void CloseShim(Profile* profile, const std::string& app_id); 60 void CloseShim(Profile* profile, const std::string& app_id);
53 61
54 HostMap hosts_; 62 HostMap hosts_;
55 63
56 content::NotificationRegistrar registrar_; 64 content::NotificationRegistrar registrar_;
57 }; 65 };
58 66
59 } // namespace apps 67 } // namespace apps
60 68
61 #endif // APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_ 69 #endif // APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_
OLDNEW
« no previous file with comments | « apps/app_shim/app_shim_messages.h ('k') | apps/app_shim/extension_app_shim_handler_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698