OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/launcher_page/launcher_page_api.h" | 5 #include "chrome/browser/extensions/api/launcher_page/launcher_page_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/app_list/app_list_service.h" | 9 #include "chrome/browser/ui/app_list/app_list_service.h" |
10 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 10 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
11 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 11 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
12 #include "chrome/common/extensions/api/launcher_page.h" | 12 #include "chrome/common/extensions/api/launcher_page.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "ui/app_list/app_list_model.h" | 14 #include "ui/app_list/app_list_model.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 static base::LazyInstance<BrowserContextKeyedAPIFactory<LauncherPageAPI>> | 18 static base::LazyInstance<BrowserContextKeyedAPIFactory<LauncherPageAPI>>:: |
19 g_factory = LAZY_INSTANCE_INITIALIZER; | 19 DestructorAtExit g_factory = LAZY_INSTANCE_INITIALIZER; |
20 | 20 |
21 // static | 21 // static |
22 BrowserContextKeyedAPIFactory<LauncherPageAPI>* | 22 BrowserContextKeyedAPIFactory<LauncherPageAPI>* |
23 LauncherPageAPI::GetFactoryInstance() { | 23 LauncherPageAPI::GetFactoryInstance() { |
24 return g_factory.Pointer(); | 24 return g_factory.Pointer(); |
25 } | 25 } |
26 | 26 |
27 LauncherPageAPI::LauncherPageAPI(content::BrowserContext* context) | 27 LauncherPageAPI::LauncherPageAPI(content::BrowserContext* context) |
28 : service_(app_list::AppListSyncableServiceFactory::GetForProfile( | 28 : service_(app_list::AppListSyncableServiceFactory::GetForProfile( |
29 Profile::FromBrowserContext(context))) { | 29 Profile::FromBrowserContext(context))) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 LauncherPageAPI::GetFactoryInstance() | 81 LauncherPageAPI::GetFactoryInstance() |
82 ->Get(browser_context()) | 82 ->Get(browser_context()) |
83 ->GetService(); | 83 ->GetService(); |
84 app_list::AppListModel* model = service->GetModel(); | 84 app_list::AppListModel* model = service->GetModel(); |
85 model->SetCustomLauncherPageEnabled(params->enabled); | 85 model->SetCustomLauncherPageEnabled(params->enabled); |
86 | 86 |
87 return RespondNow(NoArguments()); | 87 return RespondNow(NoArguments()); |
88 } | 88 } |
89 | 89 |
90 } // namespace extensions | 90 } // namespace extensions |
OLD | NEW |