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> |
11 | 11 |
12 #include "apps/app_shim/app_shim_messages.h" | 12 #include "apps/app_shim/app_shim_messages.h" |
13 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/mac/launch_services_util.h" | 16 #include "base/mac/launch_services_util.h" |
17 #include "base/mac/mac_logging.h" | 17 #include "base/mac/mac_logging.h" |
18 #include "base/mac/mac_util.h" | 18 #include "base/mac/mac_util.h" |
19 #include "base/mac/scoped_nsautorelease_pool.h" | 19 #include "base/mac/scoped_nsautorelease_pool.h" |
20 #include "base/memory/scoped_nsobject.h" | 20 #include "base/mac/scoped_nsobject.h" |
21 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/strings/sys_string_conversions.h" | 23 #include "base/strings/sys_string_conversions.h" |
24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_paths_internal.h" | 26 #include "chrome/common/chrome_paths_internal.h" |
27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/mac/app_mode_common.h" | 28 #include "chrome/common/mac/app_mode_common.h" |
29 #include "ipc/ipc_channel_proxy.h" | 29 #include "ipc/ipc_channel_proxy.h" |
30 #include "ipc/ipc_listener.h" | 30 #include "ipc/ipc_listener.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void OnLaunchAppDone(bool success); | 74 void OnLaunchAppDone(bool success); |
75 | 75 |
76 // Called when the app is activated, either by the user clicking on it in the | 76 // Called when the app is activated, either by the user clicking on it in the |
77 // dock or by Cmd+Tabbing to it. | 77 // dock or by Cmd+Tabbing to it. |
78 void OnDidActivateApplication(); | 78 void OnDidActivateApplication(); |
79 | 79 |
80 // Terminates the app shim process. | 80 // Terminates the app shim process. |
81 void Close(); | 81 void Close(); |
82 | 82 |
83 IPC::ChannelProxy* channel_; | 83 IPC::ChannelProxy* channel_; |
84 scoped_nsobject<AppShimDelegate> nsapp_delegate_; | 84 base::scoped_nsobject<AppShimDelegate> nsapp_delegate_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(AppShimController); | 86 DISALLOW_COPY_AND_ASSIGN(AppShimController); |
87 }; | 87 }; |
88 | 88 |
89 AppShimController::AppShimController() : channel_(NULL) {} | 89 AppShimController::AppShimController() : channel_(NULL) {} |
90 | 90 |
91 void AppShimController::Init() { | 91 void AppShimController::Init() { |
92 DCHECK(g_io_thread); | 92 DCHECK(g_io_thread); |
93 NSString* chrome_bundle_path = | 93 NSString* chrome_bundle_path = |
94 base::SysUTF8ToNSString(g_info->chrome_outer_bundle_path.value()); | 94 base::SysUTF8ToNSString(g_info->chrome_outer_bundle_path.value()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 // fully initialized don't receive a reply until its run loop starts. Once | 374 // fully initialized don't receive a reply until its run loop starts. Once |
375 // the reply is received, Chrome will have opened its IPC port, guaranteed. | 375 // the reply is received, Chrome will have opened its IPC port, guaranteed. |
376 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; | 376 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; |
377 | 377 |
378 base::MessageLoopForUI main_message_loop; | 378 base::MessageLoopForUI main_message_loop; |
379 main_message_loop.set_thread_name("MainThread"); | 379 main_message_loop.set_thread_name("MainThread"); |
380 base::PlatformThread::SetName("CrAppShimMain"); | 380 base::PlatformThread::SetName("CrAppShimMain"); |
381 main_message_loop.Run(); | 381 main_message_loop.Run(); |
382 return 0; | 382 return 0; |
383 } | 383 } |
OLD | NEW |