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

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

Issue 15269003: Refactor extension handling code from AppShimHost into ExtensionAppShimHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Instantiate ExtensionAppShimHandler in AppShimHostManager. Created 7 years, 7 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
OLDNEW
(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 APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_
6 #define APPS_APP_SHIM_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"
tapted 2013/05/23 02:29:39 I think this can go?
jackhou1 2013/05/23 06:10:19 Done.
13 #include "base/observer_list.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16
17 class Profile;
18
19 namespace apps {
20
21 // This app shim handler that handles events for app shims that correspond to an
22 // extension.
23 class ExtensionAppShimHandler : public apps::AppShimHandler,
tapted 2013/05/23 02:29:39 nit: no longer need apps:: prefix
jackhou1 2013/05/23 06:10:19 Done.
24 public content::NotificationObserver{
25 public:
26 ExtensionAppShimHandler();
27 virtual ~ExtensionAppShimHandler();
28
29 // AppShimHandler overrides:
30 virtual bool OnShimLaunch(Host* host) OVERRIDE;
31 virtual void OnShimClose(Host* host) OVERRIDE;
32 virtual void OnShimFocus(Host* host) OVERRIDE;
33
34 protected:
35 typedef std::map<std::pair<Profile*, std::string>,
36 ObserverList<apps::AppShimHandler::Host>* > HostMap;
tapted 2013/05/23 02:29:39 s/apps:://
jackhou1 2013/05/23 06:10:19 Done.
37
38 ObserverList<apps::AppShimHandler::Host>*
tapted 2013/05/23 02:29:39 s/apps:://
jackhou1 2013/05/23 06:10:19 Done.
39 FindObserverList(Profile* profile, const std::string& app_id);
40
41 ObserverList<apps::AppShimHandler::Host>*
tapted 2013/05/23 02:29:39 s/apps:://
jackhou1 2013/05/23 06:10:19 Done.
42 FindOrInsertObserverList(Profile* profile, const std::string& app_id);
43
44 bool RemoveObserverList(Profile* profile, const std::string& app_id);
45
46 content::NotificationRegistrar* registrar() { return &registrar_; }
tapted 2013/05/23 02:29:39 nit: a reference is probably better here, since it
jackhou1 2013/05/23 06:10:19 Done.
47
48 private:
49 virtual bool LaunchApp(Profile* profile, const std::string& app_id);
50
51 // Listen to the NOTIFICATION_EXTENSION_HOST_DESTROYED message to detect when
52 // an app closes. When that happens, call OnAppClosed on the relevant
53 // AppShimHandler::Host which causes the app shim process to quit.
54 // The host will call OnShimClose on this.
55 virtual void Observe(int type,
56 const content::NotificationSource& source,
57 const content::NotificationDetails& details) OVERRIDE;
58
59 void Close(Profile* profile, const std::string& app_id);
tapted 2013/05/23 02:29:39 Maybe CloseShim, since it's not the handler that's
jackhou1 2013/05/23 06:10:19 Done.
60
61 HostMap hosts_;
62
63 content::NotificationRegistrar registrar_;
64 };
65
66 } // namespace apps
67
68 #endif // APPS_APP_SHIM_EXTENSION_APP_SHIM_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698