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" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 chrome::GetHostDesktopTypeForNativeWindow( | 58 chrome::GetHostDesktopTypeForNativeWindow( |
59 GetAssociatedWebContents()->GetTopLevelNativeWindow()); | 59 GetAssociatedWebContents()->GetTopLevelNativeWindow()); |
60 | 60 |
61 AppListService::Get(host_desktop) | 61 AppListService::Get(host_desktop) |
62 ->ShowForCustomLauncherPage( | 62 ->ShowForCustomLauncherPage( |
63 Profile::FromBrowserContext(browser_context())); | 63 Profile::FromBrowserContext(browser_context())); |
64 | 64 |
65 return RespondNow(NoArguments()); | 65 return RespondNow(NoArguments()); |
66 } | 66 } |
67 | 67 |
| 68 LauncherPageHideFunction::LauncherPageHideFunction() { |
| 69 } |
| 70 |
| 71 ExtensionFunction::ResponseAction LauncherPageHideFunction::Run() { |
| 72 chrome::HostDesktopType host_desktop = |
| 73 chrome::GetHostDesktopTypeForNativeWindow( |
| 74 GetAssociatedWebContents()->GetTopLevelNativeWindow()); |
| 75 |
| 76 AppListService::Get(host_desktop)->HideCustomLauncherPage(); |
| 77 |
| 78 return RespondNow(NoArguments()); |
| 79 } |
| 80 |
68 LauncherPageSetEnabledFunction::LauncherPageSetEnabledFunction() { | 81 LauncherPageSetEnabledFunction::LauncherPageSetEnabledFunction() { |
69 } | 82 } |
70 | 83 |
71 ExtensionFunction::ResponseAction LauncherPageSetEnabledFunction::Run() { | 84 ExtensionFunction::ResponseAction LauncherPageSetEnabledFunction::Run() { |
72 scoped_ptr<api::launcher_page::SetEnabled::Params> params( | 85 scoped_ptr<api::launcher_page::SetEnabled::Params> params( |
73 api::launcher_page::SetEnabled::Params::Create(*args_)); | 86 api::launcher_page::SetEnabled::Params::Create(*args_)); |
74 EXTENSION_FUNCTION_VALIDATE(params.get()); | 87 EXTENSION_FUNCTION_VALIDATE(params.get()); |
75 | 88 |
76 app_list::AppListSyncableService* service = | 89 app_list::AppListSyncableService* service = |
77 LauncherPageAPI::GetFactoryInstance() | 90 LauncherPageAPI::GetFactoryInstance() |
78 ->Get(browser_context()) | 91 ->Get(browser_context()) |
79 ->GetService(); | 92 ->GetService(); |
80 app_list::AppListModel* model = service->GetModel(); | 93 app_list::AppListModel* model = service->GetModel(); |
81 model->SetCustomLauncherPageEnabled(params->enabled); | 94 model->SetCustomLauncherPageEnabled(params->enabled); |
82 | 95 |
83 return RespondNow(NoArguments()); | 96 return RespondNow(NoArguments()); |
84 } | 97 } |
85 | 98 |
86 } // namespace extensions | 99 } // namespace extensions |
OLD | NEW |