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

Unified Diff: chrome/browser/ui/app_list/app_list_service_disabled.cc

Issue 1973203002: Make --show-app-list go to the chrome://apps page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove dep patchset Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/app_list_service_disabled.cc
diff --git a/chrome/browser/ui/app_list/app_list_service_disabled.cc b/chrome/browser/ui/app_list/app_list_service_disabled.cc
index a54dd7e9a21631abb7fb0b4c6714e0ac89cb5be9..bc6e896f3c0b672cbad7dd78a24ebef68f773357 100644
--- a/chrome/browser/ui/app_list/app_list_service_disabled.cc
+++ b/chrome/browser/ui/app_list/app_list_service_disabled.cc
@@ -7,6 +7,23 @@
#include "base/memory/singleton.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
+#if defined(TOOLKIT_VIEWS)
+#include "base/command_line.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile_attributes_entry.h"
+#include "chrome/browser/profiles/profile_attributes_storage.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_navigator.h"
+#include "chrome/browser/ui/browser_navigator_params.h"
+#include "chrome/browser/ui/user_manager.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/url_constants.h"
+#include "components/signin/core/common/profile_management_switches.h"
+#include "ui/base/page_transition_types.h"
+#endif
+
namespace {
class AppListServiceDisabled : public AppListService {
@@ -57,6 +74,21 @@ class AppListServiceDisabled : public AppListService {
DISALLOW_COPY_AND_ASSIGN(AppListServiceDisabled);
};
+#if defined(TOOLKIT_VIEWS)
+bool IsProfileSignedOut(Profile* profile) {
+ // The signed out status only makes sense at the moment in the context of the
+ // --new-profile-management flag.
+ if (!switches::IsNewProfileManagement())
+ return false;
+ ProfileAttributesEntry* entry;
+ bool has_entry =
+ g_browser_process->profile_manager()
+ ->GetProfileAttributesStorage()
+ .GetProfileAttributesWithPath(profile->GetPath(), &entry);
+ return has_entry && entry->IsSigninRequired();
+}
+#endif
+
} // namespace
// static
@@ -75,5 +107,26 @@ void AppListService::RegisterPrefs(PrefRegistrySimple* registry) {}
bool AppListService::HandleLaunchCommandLine(
const base::CommandLine& command_line,
Profile* launch_profile) {
+#if defined(TOOLKIT_VIEWS)
+ if (!command_line.HasSwitch(switches::kShowAppList))
+ return false;
+
+ Browser* browser = chrome::FindLastActive();
+ Profile* app_list_profile = browser ? browser->profile() : launch_profile;
+
+ if (IsProfileSignedOut(app_list_profile) ||
+ app_list_profile->IsSystemProfile()) {
+ UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL,
+ profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
+ return true;
+ }
+
+ chrome::NavigateParams params(app_list_profile,
+ GURL(chrome::kChromeUIAppsURL),
+ ui::PAGE_TRANSITION_AUTO_BOOKMARK);
+ chrome::Navigate(&params);
+ return true;
+#else
return false;
+#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698