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

Side by Side Diff: chrome/browser/extensions/api/launcher_page/launcher_page_api.cc

Issue 1137503005: Add launcherPage.hide() API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mobile Created 5 years, 7 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
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/launcher_page/launcher_page_api.h ('k') | chrome/browser/ui/app_list/app_list_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698