Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: apps/app_shim/chrome_main_app_mode_mac.mm

Issue 23514021: Add Hide to app menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Save original key equivalent. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 private: 93 private:
94 // IPC::Listener implemetation. 94 // IPC::Listener implemetation.
95 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 95 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
96 virtual void OnChannelError() OVERRIDE; 96 virtual void OnChannelError() OVERRIDE;
97 97
98 // If Chrome failed to launch the app, |success| will be false and the app 98 // If Chrome failed to launch the app, |success| will be false and the app
99 // shim process should die. 99 // shim process should die.
100 void OnLaunchAppDone(apps::AppShimLaunchResult result); 100 void OnLaunchAppDone(apps::AppShimLaunchResult result);
101 101
102 // Hide this app.
103 void OnHide();
104
102 // Requests user attention. 105 // Requests user attention.
103 void OnRequestUserAttention(); 106 void OnRequestUserAttention();
104 107
105 // Terminates the app shim process. 108 // Terminates the app shim process.
106 void Close(); 109 void Close();
107 110
108 IPC::ChannelProxy* channel_; 111 IPC::ChannelProxy* channel_;
109 base::scoped_nsobject<AppShimDelegate> nsapp_delegate_; 112 base::scoped_nsobject<AppShimDelegate> nsapp_delegate_;
110 bool launch_app_done_; 113 bool launch_app_done_;
111 114
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 187 }
185 188
186 void AppShimController::SendQuitApp() { 189 void AppShimController::SendQuitApp() {
187 channel_->Send(new AppShimHostMsg_QuitApp); 190 channel_->Send(new AppShimHostMsg_QuitApp);
188 } 191 }
189 192
190 bool AppShimController::OnMessageReceived(const IPC::Message& message) { 193 bool AppShimController::OnMessageReceived(const IPC::Message& message) {
191 bool handled = true; 194 bool handled = true;
192 IPC_BEGIN_MESSAGE_MAP(AppShimController, message) 195 IPC_BEGIN_MESSAGE_MAP(AppShimController, message)
193 IPC_MESSAGE_HANDLER(AppShimMsg_LaunchApp_Done, OnLaunchAppDone) 196 IPC_MESSAGE_HANDLER(AppShimMsg_LaunchApp_Done, OnLaunchAppDone)
197 IPC_MESSAGE_HANDLER(AppShimMsg_Hide, OnHide)
194 IPC_MESSAGE_HANDLER(AppShimMsg_RequestUserAttention, OnRequestUserAttention) 198 IPC_MESSAGE_HANDLER(AppShimMsg_RequestUserAttention, OnRequestUserAttention)
195 IPC_MESSAGE_UNHANDLED(handled = false) 199 IPC_MESSAGE_UNHANDLED(handled = false)
196 IPC_END_MESSAGE_MAP() 200 IPC_END_MESSAGE_MAP()
197 201
198 return handled; 202 return handled;
199 } 203 }
200 204
201 void AppShimController::OnChannelError() { 205 void AppShimController::OnChannelError() {
202 Close(); 206 Close();
203 } 207 }
204 208
205 void AppShimController::OnLaunchAppDone(apps::AppShimLaunchResult result) { 209 void AppShimController::OnLaunchAppDone(apps::AppShimLaunchResult result) {
206 if (result != apps::APP_SHIM_LAUNCH_SUCCESS) { 210 if (result != apps::APP_SHIM_LAUNCH_SUCCESS) {
207 Close(); 211 Close();
208 return; 212 return;
209 } 213 }
210 214
211 launch_app_done_ = true; 215 launch_app_done_ = true;
212 } 216 }
213 217
218 void AppShimController::OnHide() {
219 [NSApp hide:nil];
220 }
221
214 void AppShimController::OnRequestUserAttention() { 222 void AppShimController::OnRequestUserAttention() {
215 [NSApp requestUserAttention:NSInformationalRequest]; 223 [NSApp requestUserAttention:NSInformationalRequest];
216 } 224 }
217 225
218 void AppShimController::Close() { 226 void AppShimController::Close() {
219 [nsapp_delegate_ terminateNow]; 227 [nsapp_delegate_ terminateNow];
220 } 228 }
221 229
222 void AppShimController::ActivateApp(bool is_reopen) { 230 void AppShimController::ActivateApp(bool is_reopen) {
223 if (launch_app_done_) { 231 if (launch_app_done_) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // fully initialized don't receive a reply until its run loop starts. Once 505 // fully initialized don't receive a reply until its run loop starts. Once
498 // the reply is received, Chrome will have opened its IPC port, guaranteed. 506 // the reply is received, Chrome will have opened its IPC port, guaranteed.
499 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)]; 507 [ReplyEventHandler pingProcess:psn andCall:base::Bind(&OnPingChromeReply)];
500 508
501 base::MessageLoopForUI main_message_loop; 509 base::MessageLoopForUI main_message_loop;
502 main_message_loop.set_thread_name("MainThread"); 510 main_message_loop.set_thread_name("MainThread");
503 base::PlatformThread::SetName("CrAppShimMain"); 511 base::PlatformThread::SetName("CrAppShimMain");
504 main_message_loop.Run(); 512 main_message_loop.Run();
505 return 0; 513 return 0;
506 } 514 }
OLDNEW
« no previous file with comments | « apps/app_shim/app_shim_quit_interactive_uitest_mac.mm ('k') | apps/app_shim/extension_app_shim_handler_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698