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

Side by Side Diff: athena/extensions/athena_app_window_client_base.cc

Issue 631333003: Adding application lifetime tests to athena, allowing to override focus request for applciations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/extensions/athena_app_window_client_base.h" 5 #include "athena/extensions/athena_app_window_client_base.h"
6 6
7 #include "athena/activity/public/activity_factory.h" 7 #include "athena/activity/public/activity_factory.h"
8 #include "athena/activity/public/activity_manager.h" 8 #include "athena/activity/public/activity_manager.h"
9 #include "athena/extensions/athena_native_app_window_views.h" 9 #include "athena/extensions/athena_native_app_window_views.h"
10 #include "athena/wm/public/window_list_provider.h"
11 #include "athena/wm/public/window_manager.h"
10 #include "extensions/common/extension.h" 12 #include "extensions/common/extension.h"
11 13
12 namespace athena { 14 namespace athena {
13 15
14 AthenaAppWindowClientBase::AthenaAppWindowClientBase() { 16 AthenaAppWindowClientBase::AthenaAppWindowClientBase() {
15 } 17 }
16 18
17 AthenaAppWindowClientBase::~AthenaAppWindowClientBase() { 19 AthenaAppWindowClientBase::~AthenaAppWindowClientBase() {
18 } 20 }
19 21
20 extensions::NativeAppWindow* AthenaAppWindowClientBase::CreateNativeAppWindow( 22 extensions::NativeAppWindow* AthenaAppWindowClientBase::CreateNativeAppWindow(
21 extensions::AppWindow* app_window, 23 extensions::AppWindow* app_window,
22 const extensions::AppWindow::CreateParams& params) { 24 extensions::AppWindow::CreateParams* params) {
23 AthenaNativeAppWindowViews* native_window = new AthenaNativeAppWindowViews; 25 AthenaNativeAppWindowViews* native_window = new AthenaNativeAppWindowViews;
24 native_window->Init(app_window, params); 26 native_window->Init(app_window, *params);
25 ActivityFactory::Get()->CreateAppActivity(app_window->extension_id(), 27 ActivityFactory::Get()->CreateAppActivity(app_window->extension_id(),
26 native_window->GetWebView()); 28 native_window->GetWebView());
29 if (params->focused) {
30 // Windows are created per default at the top of the stack. If - at this
31 // point of initialization - it is has been moved into a different Z-order
32 // location we should respect this, not allowing the application activation
33 // to bring it to the front. This can happen as part of the resource
34 // manager's reloading or intelligent preloading of an application.
35 const aura::Window::Windows& list =
36 WindowManager::Get()->GetWindowListProvider()->GetWindowList();
37 aura::Window* native_app_window =
38 native_window->widget()->GetNativeWindow();
39 params->focused = !list.size() || list.back() == native_app_window;
40 }
27 return native_window; 41 return native_window;
28 } 42 }
29 43
30 } // namespace athena 44 } // namespace athena
OLDNEW
« no previous file with comments | « athena/extensions/athena_app_window_client_base.h ('k') | chrome/browser/ui/apps/chrome_app_window_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698