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

Unified Diff: apps/app_shim/chrome_main_app_mode_mac.mm

Issue 461303002: [Mac] Bounce app shims when app windows request attention. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update FakeHost in test. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: apps/app_shim/chrome_main_app_mode_mac.mm
diff --git a/apps/app_shim/chrome_main_app_mode_mac.mm b/apps/app_shim/chrome_main_app_mode_mac.mm
index 8b91322a957c3b71f02ffe6b222b8054c851f420..ed07e6a5001079dd0786883b2aa705616950d7fd 100644
--- a/apps/app_shim/chrome_main_app_mode_mac.mm
+++ b/apps/app_shim/chrome_main_app_mode_mac.mm
@@ -131,6 +131,7 @@ class AppShimController : public IPC::Listener {
// Requests user attention.
void OnRequestUserAttention();
+ void OnSetUserAttention(apps::AppShimAttentionType attention_type);
// Terminates the app shim process.
void Close();
@@ -140,6 +141,7 @@ class AppShimController : public IPC::Listener {
base::scoped_nsobject<AppShimDelegate> delegate_;
bool launch_app_done_;
bool ping_chrome_reply_received_;
+ NSInteger attention_request_id_;
DISALLOW_COPY_AND_ASSIGN(AppShimController);
};
@@ -147,7 +149,8 @@ class AppShimController : public IPC::Listener {
AppShimController::AppShimController()
: delegate_([[AppShimDelegate alloc] init]),
launch_app_done_(false),
- ping_chrome_reply_received_(false) {
+ ping_chrome_reply_received_(false),
+ attention_request_id_(0) {
// Since AppShimController is created before the main message loop starts,
// NSApp will not be set, so use sharedApplication.
[[NSApplication sharedApplication] setDelegate:delegate_];
@@ -282,6 +285,7 @@ bool AppShimController::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AppShimMsg_LaunchApp_Done, OnLaunchAppDone)
IPC_MESSAGE_HANDLER(AppShimMsg_Hide, OnHide)
IPC_MESSAGE_HANDLER(AppShimMsg_RequestUserAttention, OnRequestUserAttention)
+ IPC_MESSAGE_HANDLER(AppShimMsg_SetUserAttention, OnSetUserAttention)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -310,7 +314,26 @@ void AppShimController::OnHide() {
}
void AppShimController::OnRequestUserAttention() {
- [NSApp requestUserAttention:NSInformationalRequest];
+ OnSetUserAttention(apps::APP_SHIM_ATTENTION_INFORMATIONAL);
+}
+
+void AppShimController::OnSetUserAttention(
+ apps::AppShimAttentionType attention_type) {
+ switch (attention_type) {
+ case apps::APP_SHIM_ATTENTION_CANCEL:
+ [NSApp cancelUserAttentionRequest:attention_request_id_];
+ attention_request_id_ = 0;
+ break;
+ case apps::APP_SHIM_ATTENTION_CRITICAL:
+ attention_request_id_ = [NSApp requestUserAttention:NSCriticalRequest];
+ break;
+ case apps::APP_SHIM_ATTENTION_INFORMATIONAL:
+ attention_request_id_ =
+ [NSApp requestUserAttention:NSInformationalRequest];
+ break;
+ case apps::APP_SHIM_ATTENTION_NUM_TYPES:
+ NOTREACHED();
+ }
}
void AppShimController::Close() {
« 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