Chromium Code Reviews| Index: apps/app_shim/extension_app_shim_handler_mac.h |
| diff --git a/apps/app_shim/extension_app_shim_handler_mac.h b/apps/app_shim/extension_app_shim_handler_mac.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48e842db7b270aea906479eefa12de74c804c733 |
| --- /dev/null |
| +++ b/apps/app_shim/extension_app_shim_handler_mac.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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.
|
| +#define CHROME_BROWSER_WEB_APPLICATIONS_EXTENSION_APP_SHIM_HANDLER_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "apps/app_shim/app_shim_handler_mac.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/observer_list.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#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.
|
| +#include "ipc/ipc_sender.h" |
| + |
| +class Profile; |
| + |
| +// This app shim handler that handles events for app shims that correspond to an |
| +// extension. |
| +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.
|
| + public content::NotificationObserver, |
| + 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.
|
| + public: |
| + ExtensionAppShimHandler(); |
| + virtual ~ExtensionAppShimHandler(); |
| + |
| + // 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.
|
| + virtual bool OnShimLaunch(Host* host) OVERRIDE; |
| + virtual void OnShimClose(Host* host) OVERRIDE; |
| + virtual void OnShimFocus(Host* host) OVERRIDE; |
| + |
| + protected: |
| + typedef std::map<std::pair<Profile*, std::string>, |
| + ObserverList<apps::AppShimHandler::Host>* > HostMap; |
| + |
| + HostMap::mapped_type GetObserverList(Profile* profile, |
| + const std::string& app_id, |
| + bool create_if_not_exist); |
| + |
| + 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.
|
| + |
| + private: |
| + virtual bool LaunchApp(Profile* profile, const std::string& app_id); |
| + |
| + // Listen to the NOTIFICATION_EXTENSION_HOST_DESTROYED message to detect when |
| + // an app closes. When that happens, call OnAppClosed on the relevant |
| + // AppShimHandler::Host which causes the app shim process to quit. |
| + // The host will call OnShimClose on this. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + void Close(Profile* profile, const std::string& app_id); |
| + |
| + HostMap hosts_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_WEB_APPLICATIONS_EXTENSION_APP_SHIM_HANDLER_H_ |