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 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ | 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ |
6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ | 6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // IPC::Sender implementation. | 53 // IPC::Sender implementation. |
54 virtual bool Send(IPC::Message* message) OVERRIDE; | 54 virtual bool Send(IPC::Message* message) OVERRIDE; |
55 | 55 |
56 private: | 56 private: |
57 // The app shim process is requesting that an app be launched. Once it has | 57 // The app shim process is requesting that an app be launched. Once it has |
58 // done so the |profile| and |app_id| are stored, and all future messages | 58 // done so the |profile| and |app_id| are stored, and all future messages |
59 // from the app shim relate to the app it launched. It is an error for the | 59 // from the app shim relate to the app it launched. It is an error for the |
60 // app shim to send multiple launch messages. | 60 // app shim to send multiple launch messages. |
61 void OnLaunchApp(std::string profile, std::string app_id); | 61 void OnLaunchApp(std::string profile, std::string app_id); |
62 | 62 |
| 63 // Called when the app shim process notifies that the app should be brought |
| 64 // to the front (i.e. the user has clicked on the app's icon in the dock or |
| 65 // Cmd+Tabbed to it.) |
| 66 void OnFocus(); |
| 67 |
63 bool LaunchAppImpl(const std::string& profile_dir, const std::string& app_id); | 68 bool LaunchAppImpl(const std::string& profile_dir, const std::string& app_id); |
64 | 69 |
65 // The AppShimHost listens to the NOTIFICATION_EXTENSION_HOST_DESTROYED | 70 // The AppShimHost listens to the NOTIFICATION_EXTENSION_HOST_DESTROYED |
66 // message to detect when the app closes. When that happens, the AppShimHost | 71 // message to detect when the app closes. When that happens, the AppShimHost |
67 // closes the channel, which causes the app shim process to quit. | 72 // closes the channel, which causes the app shim process to quit. |
68 virtual void Observe(int type, | 73 virtual void Observe(int type, |
69 const content::NotificationSource& source, | 74 const content::NotificationSource& source, |
70 const content::NotificationDetails& details) OVERRIDE; | 75 const content::NotificationDetails& details) OVERRIDE; |
71 | 76 |
72 // Closes the channel and destroys the AppShimHost. | 77 // Closes the channel and destroys the AppShimHost. |
73 void Close(); | 78 void Close(); |
74 | 79 |
75 scoped_ptr<IPC::ChannelProxy> channel_; | 80 scoped_ptr<IPC::ChannelProxy> channel_; |
76 std::string app_id_; | 81 std::string app_id_; |
77 Profile* profile_; | 82 Profile* profile_; |
78 content::NotificationRegistrar registrar_; | 83 content::NotificationRegistrar registrar_; |
79 }; | 84 }; |
80 | 85 |
81 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ | 86 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MAC_H_ |
OLD | NEW |