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

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

Issue 1990783002: Mac: Open chrome://apps when a deprecated app launcher shim connects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160518-ShimAppsPage-UPSTREAM
Patch Set: git rebase as well? 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 | chrome/browser/ui/app_list/app_list_service_disabled_mac.h » ('j') | 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 bc6e896f3c0b672cbad7dd78a24ebef68f773357..56c87a72b7cc5df55f81305f0bdf8595d929ff70 100644
--- a/chrome/browser/ui/app_list/app_list_service_disabled.cc
+++ b/chrome/browser/ui/app_list/app_list_service_disabled.cc
@@ -5,6 +5,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
+#include "build/build_config.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
#if defined(TOOLKIT_VIEWS)
@@ -24,6 +25,10 @@
#include "ui/base/page_transition_types.h"
#endif
+#if defined(OS_MACOSX)
+#include "chrome/browser/ui/app_list/app_list_service_disabled_mac.h"
+#endif
+
namespace {
class AppListServiceDisabled : public AppListService {
@@ -87,6 +92,26 @@ bool IsProfileSignedOut(Profile* profile) {
.GetProfileAttributesWithPath(profile->GetPath(), &entry);
return has_entry && entry->IsSigninRequired();
}
+
+// Opens a Chrome browser tab at chrome://apps.
+void OpenAppsPage(Profile* fallback_profile) {
+ Browser* browser = chrome::FindLastActive();
+ Profile* app_list_profile = browser ? browser->profile() : fallback_profile;
+ app_list_profile = app_list_profile->GetOriginalProfile();
+
+ if (IsProfileSignedOut(app_list_profile) ||
+ app_list_profile->IsSystemProfile() ||
+ app_list_profile->IsGuestSession()) {
+ UserManager::Show(base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL,
+ profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
+ return;
+ }
+
+ chrome::NavigateParams params(app_list_profile,
+ GURL(chrome::kChromeUIAppsURL),
+ ui::PAGE_TRANSITION_AUTO_BOOKMARK);
+ chrome::Navigate(&params);
+}
#endif
} // namespace
@@ -98,7 +123,11 @@ AppListService* AppListService::Get() {
// static
void AppListService::InitAll(Profile* initial_profile,
- const base::FilePath& profile_path) {}
+ const base::FilePath& profile_path) {
+#if defined(OS_MACOSX)
+ InitAppsPageLegacyShimHandler(&OpenAppsPage);
+#endif
+}
// static
void AppListService::RegisterPrefs(PrefRegistrySimple* registry) {}
@@ -111,20 +140,7 @@ bool AppListService::HandleLaunchCommandLine(
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);
+ OpenAppsPage(launch_profile);
return true;
#else
return false;
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/app_list_service_disabled_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698