| 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" |
| 11 #include "apps/saved_files_service.h" | 11 #include "apps/saved_files_service.h" |
| 12 #include "base/base64.h" | 12 #include "base/base64.h" |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/files/file_enumerator.h" | 16 #include "base/files/file_enumerator.h" |
| 17 #include "base/i18n/file_util_icu.h" | 17 #include "base/i18n/file_util_icu.h" |
| 18 #include "base/lazy_instance.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/values.h" | 21 #include "base/values.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/devtools/devtools_window.h" | 23 #include "chrome/browser/devtools/devtools_window.h" |
| 23 #include "chrome/browser/extensions/api/developer_private/developer_private_api_
factory.h" | |
| 24 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 24 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
| 25 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 25 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 26 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 26 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
| 27 #include "chrome/browser/extensions/devtools_util.h" | 27 #include "chrome/browser/extensions/devtools_util.h" |
| 28 #include "chrome/browser/extensions/extension_disabled_ui.h" | 28 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 29 #include "chrome/browser/extensions/extension_error_reporter.h" | 29 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 30 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
| 31 #include "chrome/browser/extensions/extension_util.h" | 31 #include "chrome/browser/extensions/extension_util.h" |
| 32 #include "chrome/browser/extensions/unpacked_installer.h" | 32 #include "chrome/browser/extensions/unpacked_installer.h" |
| 33 #include "chrome/browser/extensions/updater/extension_updater.h" | 33 #include "chrome/browser/extensions/updater/extension_updater.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 namespace AllowFileAccess = api::developer_private::AllowFileAccess; | 144 namespace AllowFileAccess = api::developer_private::AllowFileAccess; |
| 145 namespace AllowIncognito = api::developer_private::AllowIncognito; | 145 namespace AllowIncognito = api::developer_private::AllowIncognito; |
| 146 namespace ChoosePath = api::developer_private::ChoosePath; | 146 namespace ChoosePath = api::developer_private::ChoosePath; |
| 147 namespace Enable = api::developer_private::Enable; | 147 namespace Enable = api::developer_private::Enable; |
| 148 namespace GetItemsInfo = api::developer_private::GetItemsInfo; | 148 namespace GetItemsInfo = api::developer_private::GetItemsInfo; |
| 149 namespace Inspect = api::developer_private::Inspect; | 149 namespace Inspect = api::developer_private::Inspect; |
| 150 namespace PackDirectory = api::developer_private::PackDirectory; | 150 namespace PackDirectory = api::developer_private::PackDirectory; |
| 151 namespace Reload = api::developer_private::Reload; | 151 namespace Reload = api::developer_private::Reload; |
| 152 | 152 |
| 153 DeveloperPrivateAPI* DeveloperPrivateAPI::Get(Profile* profile) { | 153 static base::LazyInstance<ProfileKeyedAPIFactory<DeveloperPrivateAPI> > |
| 154 return DeveloperPrivateAPIFactory::GetForProfile(profile); | 154 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 155 |
| 156 // static |
| 157 ProfileKeyedAPIFactory<DeveloperPrivateAPI>* |
| 158 DeveloperPrivateAPI::GetFactoryInstance() { |
| 159 return g_factory.Pointer(); |
| 155 } | 160 } |
| 156 | 161 |
| 157 DeveloperPrivateAPI::DeveloperPrivateAPI(Profile* profile) : profile_(profile) { | 162 // static |
| 163 DeveloperPrivateAPI* DeveloperPrivateAPI::Get( |
| 164 content::BrowserContext* context) { |
| 165 return GetFactoryInstance()->GetForProfile(context); |
| 166 } |
| 167 |
| 168 DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context) |
| 169 : profile_(Profile::FromBrowserContext(context)) { |
| 158 RegisterNotifications(); | 170 RegisterNotifications(); |
| 159 } | 171 } |
| 160 | 172 |
| 161 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) | 173 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) |
| 162 : profile_(profile) { | 174 : profile_(profile) { |
| 163 int types[] = { | 175 int types[] = { |
| 164 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 176 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 165 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 177 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
| 166 chrome::NOTIFICATION_EXTENSION_LOADED, | 178 chrome::NOTIFICATION_EXTENSION_LOADED, |
| 167 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 179 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 } | 1355 } |
| 1344 | 1356 |
| 1345 error_ui_util::HandleOpenDevTools(dict); | 1357 error_ui_util::HandleOpenDevTools(dict); |
| 1346 | 1358 |
| 1347 return true; | 1359 return true; |
| 1348 } | 1360 } |
| 1349 | 1361 |
| 1350 } // namespace api | 1362 } // namespace api |
| 1351 | 1363 |
| 1352 } // namespace extensions | 1364 } // namespace extensions |
| OLD | NEW |