OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
9 #include "apps/app_window.h" | 9 #include "apps/app_window.h" |
10 #include "apps/app_window_registry.h" | 10 #include "apps/app_window_registry.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 return GetFactoryInstance()->Get(context); | 167 return GetFactoryInstance()->Get(context); |
168 } | 168 } |
169 | 169 |
170 DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context) | 170 DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context) |
171 : profile_(Profile::FromBrowserContext(context)) { | 171 : profile_(Profile::FromBrowserContext(context)) { |
172 RegisterNotifications(); | 172 RegisterNotifications(); |
173 } | 173 } |
174 | 174 |
175 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) | 175 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) |
176 : profile_(profile) { | 176 : profile_(profile) { |
177 int types[] = {chrome::NOTIFICATION_EXTENSION_INSTALLED, | 177 int types[] = {chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, |
178 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 178 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
179 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 179 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
180 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 180 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
181 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, | 181 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, |
182 chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED}; | 182 chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED}; |
183 | 183 |
184 CHECK(registrar_.IsEmpty()); | 184 CHECK(registrar_.IsEmpty()); |
185 for (size_t i = 0; i < arraysize(types); ++i) { | 185 for (size_t i = 0; i < arraysize(types); ++i) { |
186 registrar_.Add(this, | 186 registrar_.Add(this, |
187 types[i], | 187 types[i], |
(...skipping 22 matching lines...) Expand all Loading... |
210 const content::NotificationSource& source, | 210 const content::NotificationSource& source, |
211 const content::NotificationDetails& details) { | 211 const content::NotificationDetails& details) { |
212 const char* event_name = NULL; | 212 const char* event_name = NULL; |
213 Profile* profile = content::Source<Profile>(source).ptr(); | 213 Profile* profile = content::Source<Profile>(source).ptr(); |
214 CHECK(profile); | 214 CHECK(profile); |
215 CHECK(profile_->IsSameProfile(profile)); | 215 CHECK(profile_->IsSameProfile(profile)); |
216 developer::EventData event_data; | 216 developer::EventData event_data; |
217 const Extension* extension = NULL; | 217 const Extension* extension = NULL; |
218 | 218 |
219 switch (type) { | 219 switch (type) { |
220 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 220 case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: |
221 event_data.event_type = developer::EVENT_TYPE_INSTALLED; | 221 event_data.event_type = developer::EVENT_TYPE_INSTALLED; |
222 extension = | 222 extension = |
223 content::Details<const InstalledExtensionInfo>(details)->extension; | 223 content::Details<const InstalledExtensionInfo>(details)->extension; |
224 break; | 224 break; |
225 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: | 225 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: |
226 event_data.event_type = developer::EVENT_TYPE_UNINSTALLED; | 226 event_data.event_type = developer::EVENT_TYPE_UNINSTALLED; |
227 extension = content::Details<const Extension>(details).ptr(); | 227 extension = content::Details<const Extension>(details).ptr(); |
228 break; | 228 break; |
229 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: | 229 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
230 event_data.event_type = developer::EVENT_TYPE_LOADED; | 230 event_data.event_type = developer::EVENT_TYPE_LOADED; |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 } | 1355 } |
1356 | 1356 |
1357 error_ui_util::HandleOpenDevTools(dict); | 1357 error_ui_util::HandleOpenDevTools(dict); |
1358 | 1358 |
1359 return true; | 1359 return true; |
1360 } | 1360 } |
1361 | 1361 |
1362 } // namespace api | 1362 } // namespace api |
1363 | 1363 |
1364 } // namespace extensions | 1364 } // namespace extensions |
OLD | NEW |