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

Side by Side Diff: apps/app_shim/extension_app_shim_handler_mac.cc

Issue 461303002: [Mac] Bounce app shims when app windows request attention. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 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 #include "apps/app_shim/extension_app_shim_handler_mac.h" 5 #include "apps/app_shim/extension_app_shim_handler_mac.h"
6 6
7 #include "apps/app_lifetime_monitor_factory.h" 7 #include "apps/app_lifetime_monitor_factory.h"
8 #include "apps/app_shim/app_shim_host_manager_mac.h" 8 #include "apps/app_shim/app_shim_host_manager_mac.h"
9 #include "apps/app_shim/app_shim_messages.h" 9 #include "apps/app_shim/app_shim_messages.h"
10 #include "apps/app_window.h" 10 #include "apps/app_window.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 handler->OnShimFocus(host, 260 handler->OnShimFocus(host,
261 APP_SHIM_FOCUS_NORMAL, 261 APP_SHIM_FOCUS_NORMAL,
262 std::vector<base::FilePath>()); 262 std::vector<base::FilePath>());
263 } else { 263 } else {
264 FocusWindows( 264 FocusWindows(
265 apps::AppWindowRegistry::Get(profile)->GetAppWindowsForApp(app_id)); 265 apps::AppWindowRegistry::Get(profile)->GetAppWindowsForApp(app_id));
266 } 266 }
267 } 267 }
268 268
269 // static 269 // static
270 bool ExtensionAppShimHandler::RequestUserAttentionForWindow( 270 bool ExtensionAppShimHandler::ActivateAndRequestUserAttentionForWindow(
271 AppWindow* app_window) { 271 AppWindow* app_window) {
272 ExtensionAppShimHandler* handler = GetInstance(); 272 ExtensionAppShimHandler* handler = GetInstance();
273 Profile* profile = Profile::FromBrowserContext(app_window->browser_context()); 273 Profile* profile = Profile::FromBrowserContext(app_window->browser_context());
274 Host* host = handler->FindHost(profile, app_window->extension_id()); 274 Host* host = handler->FindHost(profile, app_window->extension_id());
275 if (host) { 275 if (host) {
276 // Bring the window to the front without showing it. 276 // Bring the window to the front without showing it.
277 AppWindowRegistry::Get(profile)->AppWindowActivated(app_window); 277 AppWindowRegistry::Get(profile)->AppWindowActivated(app_window);
278 host->OnAppRequestUserAttention(); 278 host->OnAppRequestUserAttention(APP_SHIM_ATTENTION_INFORMATIONAL);
279 return true; 279 return true;
280 } else { 280 } else {
281 // Just show the app. 281 // Just show the app.
282 SetAppHidden(profile, app_window->extension_id(), false); 282 SetAppHidden(profile, app_window->extension_id(), false);
283 return false; 283 return false;
284 } 284 }
285 } 285 }
286 286
287 // static 287 // static
288 bool ExtensionAppShimHandler::RequestUserAttentionForWindow(
289 AppWindow* app_window,
290 AppShimAttentionType attention_type) {
291 ExtensionAppShimHandler* handler = GetInstance();
292 Profile* profile = Profile::FromBrowserContext(app_window->browser_context());
293 Host* host = handler->FindHost(profile, app_window->extension_id());
294 if (host)
295 host->OnAppRequestUserAttention(attention_type);
296 return host;
297 }
298
299 // static
288 void ExtensionAppShimHandler::OnChromeWillHide() { 300 void ExtensionAppShimHandler::OnChromeWillHide() {
289 // Send OnAppHide to all the shims so that they go into the hidden state. 301 // Send OnAppHide to all the shims so that they go into the hidden state.
290 // This is necessary so that when the shim is next focused, it will know to 302 // This is necessary so that when the shim is next focused, it will know to
291 // unhide. 303 // unhide.
292 ExtensionAppShimHandler* handler = GetInstance(); 304 ExtensionAppShimHandler* handler = GetInstance();
293 for (HostMap::iterator it = handler->hosts_.begin(); 305 for (HostMap::iterator it = handler->hosts_.begin();
294 it != handler->hosts_.end(); 306 it != handler->hosts_.end();
295 ++it) { 307 ++it) {
296 it->second->OnAppHide(); 308 it->second->OnAppHide();
297 } 309 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 if (hosts_.empty()) 547 if (hosts_.empty())
536 delegate_->MaybeTerminate(); 548 delegate_->MaybeTerminate();
537 } 549 }
538 550
539 void ExtensionAppShimHandler::OnAppStop(Profile* profile, 551 void ExtensionAppShimHandler::OnAppStop(Profile* profile,
540 const std::string& app_id) {} 552 const std::string& app_id) {}
541 553
542 void ExtensionAppShimHandler::OnChromeTerminating() {} 554 void ExtensionAppShimHandler::OnChromeTerminating() {}
543 555
544 } // namespace apps 556 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698