| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // a QuitApp message. | 81 // a QuitApp message. |
| 82 - (void)terminateNow; | 82 - (void)terminateNow; |
| 83 | 83 |
| 84 @end | 84 @end |
| 85 | 85 |
| 86 // The AppShimController is responsible for communication with the main Chrome | 86 // The AppShimController is responsible for communication with the main Chrome |
| 87 // process, and generally controls the lifetime of the app shim process. | 87 // process, and generally controls the lifetime of the app shim process. |
| 88 class AppShimController : public IPC::Listener { | 88 class AppShimController : public IPC::Listener { |
| 89 public: | 89 public: |
| 90 AppShimController(); | 90 AppShimController(); |
| 91 virtual ~AppShimController(); | 91 ~AppShimController() override; |
| 92 | 92 |
| 93 // Called when the main Chrome process responds to the Apple Event ping that | 93 // Called when the main Chrome process responds to the Apple Event ping that |
| 94 // was sent, or when the ping fails (if |success| is false). | 94 // was sent, or when the ping fails (if |success| is false). |
| 95 void OnPingChromeReply(bool success); | 95 void OnPingChromeReply(bool success); |
| 96 | 96 |
| 97 // Called |kPingChromeTimeoutSeconds| after startup, to allow a timeout on the | 97 // Called |kPingChromeTimeoutSeconds| after startup, to allow a timeout on the |
| 98 // ping event to be detected. | 98 // ping event to be detected. |
| 99 void OnPingChromeTimeout(); | 99 void OnPingChromeTimeout(); |
| 100 | 100 |
| 101 // Connects to Chrome and sends a LaunchApp message. | 101 // Connects to Chrome and sends a LaunchApp message. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 112 void SendQuitApp(); | 112 void SendQuitApp(); |
| 113 | 113 |
| 114 // Called when the app is activated, e.g. by clicking on it in the dock, by | 114 // Called when the app is activated, e.g. by clicking on it in the dock, by |
| 115 // dropping a file on the dock icon, or by Cmd+Tabbing to it. | 115 // dropping a file on the dock icon, or by Cmd+Tabbing to it. |
| 116 // Returns whether the message was sent. | 116 // Returns whether the message was sent. |
| 117 bool SendFocusApp(apps::AppShimFocusType focus_type, | 117 bool SendFocusApp(apps::AppShimFocusType focus_type, |
| 118 const std::vector<base::FilePath>& files); | 118 const std::vector<base::FilePath>& files); |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 // IPC::Listener implemetation. | 121 // IPC::Listener implemetation. |
| 122 virtual bool OnMessageReceived(const IPC::Message& message) override; | 122 bool OnMessageReceived(const IPC::Message& message) override; |
| 123 virtual void OnChannelError() override; | 123 void OnChannelError() override; |
| 124 | 124 |
| 125 // If Chrome failed to launch the app, |success| will be false and the app | 125 // If Chrome failed to launch the app, |success| will be false and the app |
| 126 // shim process should die. | 126 // shim process should die. |
| 127 void OnLaunchAppDone(apps::AppShimLaunchResult result); | 127 void OnLaunchAppDone(apps::AppShimLaunchResult result); |
| 128 | 128 |
| 129 // Hide this app. | 129 // Hide this app. |
| 130 void OnHide(); | 130 void OnHide(); |
| 131 | 131 |
| 132 // Requests user attention. | 132 // Requests user attention. |
| 133 void OnRequestUserAttention(); | 133 void OnRequestUserAttention(); |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 // minute. | 684 // minute. |
| 685 main_message_loop.PostTask( | 685 main_message_loop.PostTask( |
| 686 FROM_HERE, | 686 FROM_HERE, |
| 687 base::Bind(&AppShimController::Init, | 687 base::Bind(&AppShimController::Init, |
| 688 base::Unretained(&controller))); | 688 base::Unretained(&controller))); |
| 689 } | 689 } |
| 690 | 690 |
| 691 main_message_loop.Run(); | 691 main_message_loop.Run(); |
| 692 return 0; | 692 return 0; |
| 693 } | 693 } |
| OLD | NEW |