OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // On Mac, one can't make shortcuts with command-line arguments. Instead, we | 5 // On Mac, one can't make shortcuts with command-line arguments. Instead, we |
6 // produce small app bundles which locate the Chromium framework and load it, | 6 // produce small app bundles which locate the Chromium framework and load it, |
7 // passing the appropriate data. This is the entry point into the framework for | 7 // passing the appropriate data. This is the entry point into the framework for |
8 // those app bundles. | 8 // those app bundles. |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (!chrome::GetUserDataDirectoryForBrowserBundle(chrome_bundle, | 104 if (!chrome::GetUserDataDirectoryForBrowserBundle(chrome_bundle, |
105 &user_data_dir)) { | 105 &user_data_dir)) { |
106 Close(); | 106 Close(); |
107 return; | 107 return; |
108 } | 108 } |
109 | 109 |
110 base::FilePath socket_path = | 110 base::FilePath socket_path = |
111 user_data_dir.Append(app_mode::kAppShimSocketName); | 111 user_data_dir.Append(app_mode::kAppShimSocketName); |
112 IPC::ChannelHandle handle(socket_path.value()); | 112 IPC::ChannelHandle handle(socket_path.value()); |
113 channel_ = new IPC::ChannelProxy(handle, IPC::Channel::MODE_NAMED_CLIENT, | 113 channel_ = new IPC::ChannelProxy(handle, IPC::Channel::MODE_NAMED_CLIENT, |
114 this, g_io_thread->message_loop_proxy()); | 114 this, g_io_thread->message_loop_proxy().get()); |
115 | 115 |
116 channel_->Send(new AppShimHostMsg_LaunchApp( | 116 channel_->Send(new AppShimHostMsg_LaunchApp( |
117 g_info->profile_dir, g_info->app_mode_id, | 117 g_info->profile_dir, g_info->app_mode_id, |
118 CommandLine::ForCurrentProcess()->HasSwitch(app_mode::kNoLaunchApp) ? | 118 CommandLine::ForCurrentProcess()->HasSwitch(app_mode::kNoLaunchApp) ? |
119 apps::APP_SHIM_LAUNCH_REGISTER_ONLY : apps::APP_SHIM_LAUNCH_NORMAL)); | 119 apps::APP_SHIM_LAUNCH_REGISTER_ONLY : apps::APP_SHIM_LAUNCH_NORMAL)); |
120 | 120 |
121 nsapp_delegate_.reset([[AppShimDelegate alloc] initWithController:this]); | 121 nsapp_delegate_.reset([[AppShimDelegate alloc] initWithController:this]); |
122 DCHECK(![NSApp delegate]); | 122 DCHECK(![NSApp delegate]); |
123 [NSApp setDelegate:nsapp_delegate_]; | 123 [NSApp setDelegate:nsapp_delegate_]; |
124 } | 124 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 // fully initialized don't receive a reply until its run loop starts. Once | 384 // fully initialized don't receive a reply until its run loop starts. Once |
385 // the reply is received, Chrome will have opened its IPC port, guaranteed. | 385 // the reply is received, Chrome will have opened its IPC port, guaranteed. |
386 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; | 386 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; |
387 | 387 |
388 base::MessageLoopForUI main_message_loop; | 388 base::MessageLoopForUI main_message_loop; |
389 main_message_loop.set_thread_name("MainThread"); | 389 main_message_loop.set_thread_name("MainThread"); |
390 base::PlatformThread::SetName("CrAppShimMain"); | 390 base::PlatformThread::SetName("CrAppShimMain"); |
391 main_message_loop.Run(); | 391 main_message_loop.Run(); |
392 return 0; | 392 return 0; |
393 } | 393 } |
OLD | NEW |