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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/developer_private/developer_private_api.cc
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index de3b111224e81bdf759d7735c23184b4ce9a950d..77164046632501374650595e290fc43e1c88fcbe 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -15,12 +15,12 @@
#include "base/file_util.h"
#include "base/files/file_enumerator.h"
#include "base/i18n/file_util_icu.h"
+#include "base/lazy_instance.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/devtools/devtools_window.h"
-#include "chrome/browser/extensions/api/developer_private/developer_private_api_factory.h"
#include "chrome/browser/extensions/api/developer_private/entry_picker.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
@@ -150,11 +150,23 @@ namespace Inspect = api::developer_private::Inspect;
namespace PackDirectory = api::developer_private::PackDirectory;
namespace Reload = api::developer_private::Reload;
-DeveloperPrivateAPI* DeveloperPrivateAPI::Get(Profile* profile) {
- return DeveloperPrivateAPIFactory::GetForProfile(profile);
+static base::LazyInstance<ProfileKeyedAPIFactory<DeveloperPrivateAPI> >
+ g_factory = LAZY_INSTANCE_INITIALIZER;
+
+// static
+ProfileKeyedAPIFactory<DeveloperPrivateAPI>*
+DeveloperPrivateAPI::GetFactoryInstance() {
+ return g_factory.Pointer();
+}
+
+// static
+DeveloperPrivateAPI* DeveloperPrivateAPI::Get(
+ content::BrowserContext* context) {
+ return GetFactoryInstance()->GetForProfile(context);
}
-DeveloperPrivateAPI::DeveloperPrivateAPI(Profile* profile) : profile_(profile) {
+DeveloperPrivateAPI::DeveloperPrivateAPI(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)) {
RegisterNotifications();
}

Powered by Google App Engine
This is Rietveld 408576698