Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[mac] App shims

The AppShimHostController uses an IPC::ChannelFactory to listen on a socket for
app shims connecting. App shims send a launch message when they start, so we
translate that into actually launching the app.

I changed chrome_main_app_mode_mac.mm to use the IPC channel instead of sending
an Apple Event as before, and added an event loop and an IO thread.

BUG=138733


Review URL: https://chromiumcodereview.appspot.com/12623005

git-svn-id: http://src.chromium.org/svn/trunk/src/chrome/browser@188675 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
  • Loading branch information...
commit 8649ea2520e430be5a8c8f644f705ee5926cffd9 1 parent b0b019e
jeremya@chromium.org authored
View
39 app_controller_mac.mm
@@ -184,8 +184,6 @@ - (void)openUrls:(const std::vector<GURL>&)urls;
- (void)getUrl:(NSAppleEventDescriptor*)event
withReply:(NSAppleEventDescriptor*)reply;
- (void)submitCloudPrintJob:(NSAppleEventDescriptor*)event;
-- (void)launchPlatformApp:(NSAppleEventDescriptor*)event
- withReply:(NSAppleEventDescriptor*)reply;
- (void)windowLayeringDidChange:(NSNotification*)inNotification;
- (void)windowChangedToProfile:(Profile*)profile;
- (void)checkForAnyKeyWindows;
@@ -217,11 +215,6 @@ - (void)awakeFromNib {
forEventClass:'WWW!' // A particularly ancient AppleEvent that dates
andEventID:'OURL']; // back to the Spyglass days.
- [em setEventHandler:self
- andSelector:@selector(launchPlatformApp:withReply:)
- forEventClass:app_mode::kAEChromeAppClass
- andEventID:app_mode::kAEChromeAppLaunch];
-
// Register for various window layering changes. We use these to update
// various UI elements (command-key equivalents, etc) when the frontmost
// window changes.
@@ -1146,38 +1139,6 @@ - (void)getUrl:(NSAppleEventDescriptor*)event
[self openUrls:gurlVector];
}
-- (void)launchPlatformApp:(NSAppleEventDescriptor*)event
- withReply:(NSAppleEventDescriptor*)reply {
- NSString* appId =
- [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
- NSString* profileDir =
- [[event paramDescriptorForKeyword:app_mode::kAEProfileDirKey]
- stringValue];
-
- ProfileManager* profileManager = g_browser_process->profile_manager();
- base::FilePath path = base::FilePath(base::SysNSStringToUTF8(profileDir));
- path = profileManager->user_data_dir().Append(path);
- Profile* profile = profileManager->GetProfile(path);
- if (!profile) {
- LOG(ERROR) << "Unable to locate a suitable profile for profile directory '"
- << profileDir << "' while trying to load app with id '"
- << appId << "'.";
- return;
- }
- ExtensionServiceInterface* extensionService =
- extensions::ExtensionSystem::Get(profile)->extension_service();
- const extensions::Extension* extension =
- extensionService->GetExtensionById(
- base::SysNSStringToUTF8(appId), false);
- if (!extension) {
- LOG(ERROR) << "Shortcut attempted to launch nonexistent app with id '"
- << base::SysNSStringToUTF8(appId) << "'.";
- return;
- }
- chrome::OpenApplication(chrome::AppLaunchParams(
- profile, extension, extension_misc::LAUNCH_NONE, NEW_WINDOW));
-}
-
// Apple Event handler that receives print event from service
// process, gets the required data and launches Print dialog.
- (void)submitCloudPrintJob:(NSAppleEventDescriptor*)event {
View
12 browser_process_impl.cc
@@ -120,6 +120,10 @@
#include "chrome/browser/plugins/plugins_resource_service.h"
#endif
+#if defined(OS_MACOSX)
+#include "apps/app_shim/app_shim_host_manager_mac.h"
+#endif
+
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
// How often to check if the persistent instance of Chrome needs to restart
// to install an update.
@@ -266,6 +270,10 @@ void BrowserProcessImpl::StartTearDown() {
// monitor information.
aura::Env::DeleteInstance();
#endif
+
+#if defined(OS_MACOSX)
+ app_shim_host_manager_.reset();
+#endif
}
void BrowserProcessImpl::PostDestroyThreads() {
@@ -896,6 +904,10 @@ void BrowserProcessImpl::PreMainMessageLoopRun() {
bookmark_prompt_controller_.reset(new BookmarkPromptController());
}
#endif
+
+#if defined(OS_MACOSX)
+ app_shim_host_manager_.reset(new AppShimHostManager);
+#endif
}
void BrowserProcessImpl::CreateIconManager() {
View
9 browser_process_impl.h
@@ -45,6 +45,10 @@ class PolicyService;
class MetroViewerProcessHost;
#endif
+#if defined(OS_MACOSX)
+class AppShimHostManager;
+#endif
+
// Real implementation of BrowserProcess that creates and returns the services.
class BrowserProcessImpl : public BrowserProcess,
public base::NonThreadSafe {
@@ -299,6 +303,11 @@ class BrowserProcessImpl : public BrowserProcess,
scoped_ptr<MetroViewerProcessHost> metro_viewer_process_host_;
#endif
+#if defined(OS_MACOSX)
+ // Hosts the IPC channel factory that App Shims connect to on Mac.
+ scoped_ptr<AppShimHostManager> app_shim_host_manager_;
+#endif
+
// TODO(eroman): Remove this when done debugging 113031. This tracks
// the callstack which released the final module reference count.
base::debug::StackTrace release_last_reference_callstack_;
Please sign in to comment.
Something went wrong with that request. Please try again.