| 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_APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ | 5 #ifndef CHROME_BROWSER_APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ |
| 6 #define CHROME_BROWSER_APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ | 6 #define CHROME_BROWSER_APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 virtual void LaunchApp(Profile* profile, | 61 virtual void LaunchApp(Profile* profile, |
| 62 const extensions::Extension* extension, | 62 const extensions::Extension* extension, |
| 63 const std::vector<base::FilePath>& files); | 63 const std::vector<base::FilePath>& files); |
| 64 virtual void LaunchShim(Profile* profile, | 64 virtual void LaunchShim(Profile* profile, |
| 65 const extensions::Extension* extension); | 65 const extensions::Extension* extension); |
| 66 | 66 |
| 67 virtual void MaybeTerminate(); | 67 virtual void MaybeTerminate(); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 ExtensionAppShimHandler(); | 70 ExtensionAppShimHandler(); |
| 71 virtual ~ExtensionAppShimHandler(); | 71 ~ExtensionAppShimHandler() override; |
| 72 | 72 |
| 73 AppShimHandler::Host* FindHost(Profile* profile, const std::string& app_id); | 73 AppShimHandler::Host* FindHost(Profile* profile, const std::string& app_id); |
| 74 | 74 |
| 75 static void QuitAppForWindow(extensions::AppWindow* app_window); | 75 static void QuitAppForWindow(extensions::AppWindow* app_window); |
| 76 | 76 |
| 77 static void HideAppForWindow(extensions::AppWindow* app_window); | 77 static void HideAppForWindow(extensions::AppWindow* app_window); |
| 78 | 78 |
| 79 static void FocusAppForWindow(extensions::AppWindow* app_window); | 79 static void FocusAppForWindow(extensions::AppWindow* app_window); |
| 80 | 80 |
| 81 // Brings the window to the front without showing it and instructs the shim to | 81 // Brings the window to the front without showing it and instructs the shim to |
| 82 // request user attention. If there is no shim, show the app and return false. | 82 // request user attention. If there is no shim, show the app and return false. |
| 83 static bool ActivateAndRequestUserAttentionForWindow( | 83 static bool ActivateAndRequestUserAttentionForWindow( |
| 84 extensions::AppWindow* app_window); | 84 extensions::AppWindow* app_window); |
| 85 | 85 |
| 86 // Instructs the shim to request user attention. Returns false if there is no | 86 // Instructs the shim to request user attention. Returns false if there is no |
| 87 // shim for this window. | 87 // shim for this window. |
| 88 static void RequestUserAttentionForWindow( | 88 static void RequestUserAttentionForWindow( |
| 89 extensions::AppWindow* app_window, | 89 extensions::AppWindow* app_window, |
| 90 AppShimAttentionType attention_type); | 90 AppShimAttentionType attention_type); |
| 91 | 91 |
| 92 // Called by AppControllerMac when Chrome hides. | 92 // Called by AppControllerMac when Chrome hides. |
| 93 static void OnChromeWillHide(); | 93 static void OnChromeWillHide(); |
| 94 | 94 |
| 95 // AppShimHandler overrides: | 95 // AppShimHandler overrides: |
| 96 virtual void OnShimLaunch(Host* host, | 96 void OnShimLaunch(Host* host, |
| 97 AppShimLaunchType launch_type, | 97 AppShimLaunchType launch_type, |
| 98 const std::vector<base::FilePath>& files) override; | 98 const std::vector<base::FilePath>& files) override; |
| 99 virtual void OnShimClose(Host* host) override; | 99 void OnShimClose(Host* host) override; |
| 100 virtual void OnShimFocus(Host* host, | 100 void OnShimFocus(Host* host, |
| 101 AppShimFocusType focus_type, | 101 AppShimFocusType focus_type, |
| 102 const std::vector<base::FilePath>& files) override; | 102 const std::vector<base::FilePath>& files) override; |
| 103 virtual void OnShimSetHidden(Host* host, bool hidden) override; | 103 void OnShimSetHidden(Host* host, bool hidden) override; |
| 104 virtual void OnShimQuit(Host* host) override; | 104 void OnShimQuit(Host* host) override; |
| 105 | 105 |
| 106 // AppLifetimeMonitor::Observer overrides: | 106 // AppLifetimeMonitor::Observer overrides: |
| 107 virtual void OnAppStart(Profile* profile, const std::string& app_id) override; | 107 void OnAppStart(Profile* profile, const std::string& app_id) override; |
| 108 virtual void OnAppActivated(Profile* profile, | 108 void OnAppActivated(Profile* profile, const std::string& app_id) override; |
| 109 const std::string& app_id) override; | 109 void OnAppDeactivated(Profile* profile, const std::string& app_id) override; |
| 110 virtual void OnAppDeactivated(Profile* profile, | 110 void OnAppStop(Profile* profile, const std::string& app_id) override; |
| 111 const std::string& app_id) override; | 111 void OnChromeTerminating() override; |
| 112 virtual void OnAppStop(Profile* profile, const std::string& app_id) override; | |
| 113 virtual void OnChromeTerminating() override; | |
| 114 | 112 |
| 115 // content::NotificationObserver overrides: | 113 // content::NotificationObserver overrides: |
| 116 virtual void Observe(int type, | 114 void Observe(int type, |
| 117 const content::NotificationSource& source, | 115 const content::NotificationSource& source, |
| 118 const content::NotificationDetails& details) override; | 116 const content::NotificationDetails& details) override; |
| 119 | 117 |
| 120 protected: | 118 protected: |
| 121 typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*> | 119 typedef std::map<std::pair<Profile*, std::string>, AppShimHandler::Host*> |
| 122 HostMap; | 120 HostMap; |
| 123 | 121 |
| 124 // Exposed for testing. | 122 // Exposed for testing. |
| 125 void set_delegate(Delegate* delegate); | 123 void set_delegate(Delegate* delegate); |
| 126 HostMap& hosts() { return hosts_; } | 124 HostMap& hosts() { return hosts_; } |
| 127 content::NotificationRegistrar& registrar() { return registrar_; } | 125 content::NotificationRegistrar& registrar() { return registrar_; } |
| 128 | 126 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 150 content::NotificationRegistrar registrar_; | 148 content::NotificationRegistrar registrar_; |
| 151 | 149 |
| 152 base::WeakPtrFactory<ExtensionAppShimHandler> weak_factory_; | 150 base::WeakPtrFactory<ExtensionAppShimHandler> weak_factory_; |
| 153 | 151 |
| 154 DISALLOW_COPY_AND_ASSIGN(ExtensionAppShimHandler); | 152 DISALLOW_COPY_AND_ASSIGN(ExtensionAppShimHandler); |
| 155 }; | 153 }; |
| 156 | 154 |
| 157 } // namespace apps | 155 } // namespace apps |
| 158 | 156 |
| 159 #endif // CHROME_BROWSER_APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ | 157 #endif // CHROME_BROWSER_APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_MAC_H_ |
| OLD | NEW |