OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | |
7 | |
8 #include "chrome/browser/extensions/extension_function.h" | |
9 #include "chrome/browser/extensions/extension_install_prompt.h" | |
10 #include "chrome/browser/profiles/profile_keyed_service.h" | |
11 #include "content/public/browser/notification_observer.h" | |
12 #include "content/public/browser/notification_registrar.h" | |
13 #include "content/public/browser/render_view_host.h" | |
14 | |
15 namespace extensions { | |
miket_OOO
2012/12/06 19:31:15
Vertical whitespace inside each namespace open/clo
Gaurav
2012/12/12 02:23:38
Done.
| |
16 namespace api { | |
17 namespace developer_private { | |
18 struct ItemInfo; | |
19 struct ItemInspectView; | |
20 } | |
miket_OOO
2012/12/06 19:31:15
These normally get commented with // namespace nam
Gaurav
2012/12/12 02:23:38
Done.
| |
21 } | |
22 class ExtensionSystem; | |
23 } | |
24 | |
25 namespace developer = extensions::api::developer_private; | |
26 | |
27 typedef std::vector<linked_ptr<developer::ItemInfo> > ItemInfoList; | |
28 typedef std::vector<linked_ptr<developer::ItemInspectView> > | |
29 ItemInspectViewList; | |
30 | |
31 namespace extensions { | |
32 | |
33 // The profile-keyed service that manages the DeveloperPrivate API. | |
34 class DeveloperPrivateAPI : public ProfileKeyedService, | |
35 public content::NotificationObserver { | |
36 public: | |
37 // Convenience method to get the DeveloperPrivateAPI for a profile. | |
38 static DeveloperPrivateAPI* Get(Profile* profile); | |
39 | |
40 explicit DeveloperPrivateAPI(Profile* profile); | |
41 virtual ~DeveloperPrivateAPI(); | |
42 | |
43 void AddItemsInfo(const ExtensionSet& items, | |
44 ExtensionSystem* system, | |
45 ItemInfoList* item_list); | |
46 | |
47 // ProfileKeyedService implementation | |
48 virtual void Shutdown() OVERRIDE; | |
49 | |
50 // content::NotificationObserver implementation. | |
51 virtual void Observe(int type, | |
52 const content::NotificationSource& source, | |
53 const content::NotificationDetails& details) OVERRIDE; | |
54 | |
55 private: | |
56 | |
miket_OOO
2012/12/06 19:31:15
Be consistent about vertical whitespace after acce
Gaurav
2012/12/12 02:23:38
Done.
| |
57 void RegisterNotifications(); | |
58 | |
59 scoped_ptr<developer::ItemInfo> CreateItemInfo( | |
60 const extensions::Extension& item, | |
61 ExtensionSystem* system, | |
62 bool item_is_enabled); | |
63 | |
64 // Helper that lists the current inspectable html pages for the extension. | |
65 void GetInspectablePagesForExtensionProcess( | |
66 const std::set<content::RenderViewHost*>& views, | |
67 ItemInspectViewList* result); | |
68 | |
69 ItemInspectViewList GetInspectablePagesForExtension( | |
70 const extensions::Extension* extension, | |
71 bool extension_is_enabled); | |
72 | |
73 Profile* profile_; | |
74 | |
75 content::NotificationRegistrar registrar_; | |
76 | |
77 // The page may be refreshed in response to a RENDER_VIEW_HOST_DELETED, | |
78 // but the iteration over RenderViewHosts will include the host because the | |
79 // notification is sent when it is in the process of being deleted (and before | |
80 // it is removed from the process). Keep a pointer to it so we can exclude | |
81 // it from the active views. | |
82 content::RenderViewHost* deleting_rvh_; | |
miket_OOO
2012/12/06 19:31:15
Avoid abbreviations if possible/practical.
Gaurav
2012/12/12 02:23:38
Done.
| |
83 }; | |
84 | |
85 namespace api { | |
86 | |
87 class DeveloperPrivateAutoUpdateFunction : public SyncExtensionFunction { | |
88 public: | |
89 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.autoUpdate"); | |
90 | |
91 protected: | |
92 virtual ~DeveloperPrivateAutoUpdateFunction() {} | |
miket_OOO
2012/12/06 19:31:15
See http://dev.chromium.org/developers/coding-styl
Gaurav
2012/12/12 02:23:38
Done.
| |
93 | |
94 // ExtensionFunction: | |
95 virtual bool RunImpl() OVERRIDE; | |
96 }; | |
97 | |
98 class DeveloperPrivateGetItemsInfoFunction : public SyncExtensionFunction { | |
99 public: | |
100 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.getItemsInfo"); | |
101 | |
102 protected: | |
103 virtual ~DeveloperPrivateGetItemsInfoFunction() {} | |
miket_OOO
2012/12/06 19:31:15
Same as above.
Gaurav
2012/12/12 02:23:38
Done.
| |
104 | |
105 // ExtensionFunction: | |
106 virtual bool RunImpl() OVERRIDE; | |
107 }; | |
108 | |
109 class DeveloperPrivateInspectFunction : public SyncExtensionFunction { | |
110 public: | |
111 DECLARE_EXTENSION_FUNCTION_NAME("developerPrivate.inspect"); | |
112 | |
113 protected: | |
114 virtual ~DeveloperPrivateInspectFunction() {} | |
miket_OOO
2012/12/06 19:31:15
etc.
Gaurav
2012/12/12 02:23:38
Done.
| |
115 | |
116 // ExtensionFunction: | |
117 virtual bool RunImpl() OVERRIDE; | |
118 }; | |
119 | |
120 } // namespace api | |
miket_OOO
2012/12/06 19:31:15
vertical whitespace
always exactly two spaces bef
Gaurav
2012/12/12 02:23:38
Done.
| |
121 } // namespace extensions | |
122 | |
123 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API _H_ | |
OLD | NEW |