| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 15 matching lines...) Expand all Loading... |
| 26 #include "base/message_loop/message_loop.h" | 26 #include "base/message_loop/message_loop.h" |
| 27 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
| 28 #include "base/strings/sys_string_conversions.h" | 28 #include "base/strings/sys_string_conversions.h" |
| 29 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_paths.h" | 31 #include "chrome/common/chrome_paths.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/mac/app_mode_common.h" | 33 #include "chrome/common/mac/app_mode_common.h" |
| 34 #include "chrome/common/mac/app_shim_messages.h" | 34 #include "chrome/common/mac/app_shim_messages.h" |
| 35 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
| 36 #include "content/public/common/child_process_host.h" |
| 36 #include "ipc/ipc_channel_proxy.h" | 37 #include "ipc/ipc_channel_proxy.h" |
| 37 #include "ipc/ipc_listener.h" | 38 #include "ipc/ipc_listener.h" |
| 38 #include "ipc/ipc_message.h" | 39 #include "ipc/ipc_message.h" |
| 39 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 41 | 42 |
| 42 namespace { | 43 namespace { |
| 43 | 44 |
| 44 // Timeout in seconds to wait for a reply for the initial Apple Event. Note that | 45 // Timeout in seconds to wait for a reply for the initial Apple Event. Note that |
| 45 // kAEDefaultTimeout on Mac is "about one minute" according to Apple's | 46 // kAEDefaultTimeout on Mac is "about one minute" according to Apple's |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 205 } |
| 205 | 206 |
| 206 app_mode::VerifySocketPermissions(socket_path); | 207 app_mode::VerifySocketPermissions(socket_path); |
| 207 | 208 |
| 208 CreateChannelAndSendLaunchApp(socket_path); | 209 CreateChannelAndSendLaunchApp(socket_path); |
| 209 } | 210 } |
| 210 | 211 |
| 211 void AppShimController::CreateChannelAndSendLaunchApp( | 212 void AppShimController::CreateChannelAndSendLaunchApp( |
| 212 const base::FilePath& socket_path) { | 213 const base::FilePath& socket_path) { |
| 213 IPC::ChannelHandle handle(socket_path.value()); | 214 IPC::ChannelHandle handle(socket_path.value()); |
| 214 channel_ = IPC::ChannelProxy::Create(handle, IPC::Channel::MODE_NAMED_CLIENT, | 215 channel_ = IPC::ChannelProxy::Create( |
| 215 this, g_io_thread->task_runner().get()); | 216 handle, IPC::Channel::MODE_NAMED_CLIENT, this, |
| 217 g_io_thread->task_runner().get(), |
| 218 content::ChildProcessHost::GetAttachmentBroker()); |
| 216 | 219 |
| 217 bool launched_by_chrome = base::CommandLine::ForCurrentProcess()->HasSwitch( | 220 bool launched_by_chrome = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 218 app_mode::kLaunchedByChromeProcessId); | 221 app_mode::kLaunchedByChromeProcessId); |
| 219 apps::AppShimLaunchType launch_type = launched_by_chrome ? | 222 apps::AppShimLaunchType launch_type = launched_by_chrome ? |
| 220 apps::APP_SHIM_LAUNCH_REGISTER_ONLY : apps::APP_SHIM_LAUNCH_NORMAL; | 223 apps::APP_SHIM_LAUNCH_REGISTER_ONLY : apps::APP_SHIM_LAUNCH_NORMAL; |
| 221 | 224 |
| 222 [delegate_ setController:this]; | 225 [delegate_ setController:this]; |
| 223 | 226 |
| 224 std::vector<base::FilePath> files; | 227 std::vector<base::FilePath> files; |
| 225 [delegate_ getFilesToOpenAtStartup:&files]; | 228 [delegate_ getFilesToOpenAtStartup:&files]; |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // minute. | 694 // minute. |
| 692 main_message_loop.PostTask( | 695 main_message_loop.PostTask( |
| 693 FROM_HERE, | 696 FROM_HERE, |
| 694 base::Bind(&AppShimController::Init, | 697 base::Bind(&AppShimController::Init, |
| 695 base::Unretained(&controller))); | 698 base::Unretained(&controller))); |
| 696 } | 699 } |
| 697 | 700 |
| 698 main_message_loop.Run(); | 701 main_message_loop.Run(); |
| 699 return 0; | 702 return 0; |
| 700 } | 703 } |
| OLD | NEW |