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

Unified Diff: chrome/browser/ui/app_list/app_list_service_disabled_mac.mm

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 | « chrome/browser/ui/app_list/app_list_service_disabled_mac.h ('k') | chrome/chrome_browser_ui.gypi » ('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_mac.mm
diff --git a/chrome/browser/ui/app_list/app_list_service_disabled_mac.mm b/chrome/browser/ui/app_list/app_list_service_disabled_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..6589eb54faa91d66b3e677c285ae0b0de9e74e96
--- /dev/null
+++ b/chrome/browser/ui/app_list/app_list_service_disabled_mac.mm
@@ -0,0 +1,54 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/app_list/app_list_service_disabled_mac.h"
+
+#include "base/compiler_specific.h"
+#import "base/mac/foundation_util.h"
+#import "chrome/browser/app_controller_mac.h"
+#include "chrome/browser/apps/app_shim/app_shim_handler_mac.h"
+#include "chrome/common/mac/app_mode_common.h"
+
+namespace {
+
+// Stub handler for the old app_list shim that opens chrome://apps when a copy
+// of the App Launcher .app bundle created with Chrome < m52 tries to connect.
+class AppsPageShimHandler : public apps::AppShimHandler {
+ public:
+ explicit AppsPageShimHandler(void (*action)(Profile*)) : action_(action) {}
+
+ private:
+ // AppShimHandler:
+ void OnShimLaunch(apps::AppShimHandler::Host* host,
+ apps::AppShimLaunchType launch_type,
+ const std::vector<base::FilePath>& files) override {
+ AppController* controller =
+ base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
+ action_([controller lastProfile]);
+
+ // Always close the shim process immediately.
+ host->OnAppLaunchComplete(apps::APP_SHIM_LAUNCH_DUPLICATE_HOST);
+ }
+ void OnShimClose(apps::AppShimHandler::Host* host) override {}
+ void OnShimFocus(apps::AppShimHandler::Host* host,
+ apps::AppShimFocusType focus_type,
+ const std::vector<base::FilePath>& files) override {}
+ void OnShimSetHidden(apps::AppShimHandler::Host* host, bool hidden) override {
+ }
+ void OnShimQuit(apps::AppShimHandler::Host* host) override {}
+
+ void (*action_)(Profile*);
+
+ DISALLOW_COPY_AND_ASSIGN(AppsPageShimHandler);
+};
+
+} // namespace
+
+void InitAppsPageLegacyShimHandler(void (*action)(Profile*)) {
+ static AppsPageShimHandler* handler = nullptr;
+ if (!handler) {
+ handler = new AppsPageShimHandler(action);
+ apps::AppShimHandler::RegisterHandler(app_mode::kAppListModeId, handler);
+ }
+}
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_disabled_mac.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698