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

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: Addressed 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 // This creation will have created the window at the top. If it has been
31 // placed somewhere else it must have been done intentionally and we should
32 // not set the focus since it will change the window order again.
33 const aura::Window::Windows& window_list =
34 WindowManager::Get()->GetWindowListProvider()->GetWindowList();
35 aura::Window* native_app_window =
36 native_window->widget()->GetNativeWindow();
37 std::vector<aura::Window*>::const_iterator iter =
38 std::find(window_list.begin(), window_list.end(), native_app_window);
39 // TODO(skuhne): With issue 421680 this might get better identifiable.
40 // The application window might have been created as a panel - if it was, it
41 // will not be in our WindowListProvider list. However - if it was not at
42 // the end of the list (top of the stack), the window was intentionally
43 // moved after creation to a different location and we have to respect this
44 // location and suppress focusing - which would bring it back to the front.
45 if (iter != window_list.end() && ++iter != window_list.end())
46 params->focused = false;
47 }
27 return native_window; 48 return native_window;
28 } 49 }
29 50
30 } // namespace athena 51 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698