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

Side by Side Diff: chrome/browser/extensions/api/developer_private/developer_private_api.cc

Issue 168253002: Cleanup many APIs to use ProfileKeyedAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 namespace AllowFileAccess = api::developer_private::AllowFileAccess; 143 namespace AllowFileAccess = api::developer_private::AllowFileAccess;
144 namespace AllowIncognito = api::developer_private::AllowIncognito; 144 namespace AllowIncognito = api::developer_private::AllowIncognito;
145 namespace ChoosePath = api::developer_private::ChoosePath; 145 namespace ChoosePath = api::developer_private::ChoosePath;
146 namespace Enable = api::developer_private::Enable; 146 namespace Enable = api::developer_private::Enable;
147 namespace GetItemsInfo = api::developer_private::GetItemsInfo; 147 namespace GetItemsInfo = api::developer_private::GetItemsInfo;
148 namespace Inspect = api::developer_private::Inspect; 148 namespace Inspect = api::developer_private::Inspect;
149 namespace PackDirectory = api::developer_private::PackDirectory; 149 namespace PackDirectory = api::developer_private::PackDirectory;
150 namespace Reload = api::developer_private::Reload; 150 namespace Reload = api::developer_private::Reload;
151 151
152 static base::LazyInstance<ProfileKeyedAPIFactory<DeveloperPrivateAPI> >
153 g_factory = LAZY_INSTANCE_INITIALIZER;
154
155 // static
156 ProfileKeyedAPIFactory<DeveloperPrivateAPI>*
157 DeveloperPrivateAPI::GetFactoryInstance() {
158 return g_factory.Pointer();
159 }
160
161 // static
152 DeveloperPrivateAPI* DeveloperPrivateAPI::Get(Profile* profile) { 162 DeveloperPrivateAPI* DeveloperPrivateAPI::Get(Profile* profile) {
153 return DeveloperPrivateAPIFactory::GetForProfile(profile); 163 return GetFactoryInstance()->GetForProfile(profile);
154 } 164 }
155 165
156 DeveloperPrivateAPI::DeveloperPrivateAPI(Profile* profile) : profile_(profile) { 166 DeveloperPrivateAPI::DeveloperPrivateAPI(Profile* profile) : profile_(profile) {
157 RegisterNotifications(); 167 RegisterNotifications();
158 } 168 }
159 169
160 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) 170 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile)
161 : profile_(profile) { 171 : profile_(profile) {
162 int types[] = { 172 int types[] = {
163 chrome::NOTIFICATION_EXTENSION_INSTALLED, 173 chrome::NOTIFICATION_EXTENSION_INSTALLED,
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 } 1352 }
1343 1353
1344 error_ui_util::HandleOpenDevTools(dict); 1354 error_ui_util::HandleOpenDevTools(dict);
1345 1355
1346 return true; 1356 return true;
1347 } 1357 }
1348 1358
1349 } // namespace api 1359 } // namespace api
1350 1360
1351 } // namespace extensions 1361 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698