Index: athena/content/app_activity.cc |
diff --git a/athena/content/app_activity.cc b/athena/content/app_activity.cc |
index 56457533fd4c6ae103a9505745f37e47c383045b..587ad61e06a5a4fd148a1ad94385e0129e2071e7 100644 |
--- a/athena/content/app_activity.cc |
+++ b/athena/content/app_activity.cc |
@@ -15,6 +15,7 @@ |
#include "ui/aura/window.h" |
#include "ui/views/controls/webview/webview.h" |
#include "ui/views/widget/widget.h" |
+#include "ui/wm/core/window_util.h" |
namespace athena { |
@@ -108,10 +109,25 @@ void AppActivity::Init() { |
// |ResourceManager| - so we can move it around if needed. |
WindowListProvider* window_list_provider = |
WindowManager::Get()->GetWindowListProvider(); |
- window_list_provider->StackWindowFrontOf(app_proxy->GetWindow(), |
- GetWindow()); |
- Activity::Delete(app_proxy); |
- // With the removal the object, the proxy should be deleted. |
+ |
+ // If the proxy was the active window, its deletion will cause a window |
oshima
2014/10/08 19:02:30
Since the window may not be visible when created,
Mr4D (OOO till 08-26)
2014/10/08 23:48:16
As stated in the next comment - the visibility wil
oshima
2014/10/09 04:53:32
Acknowledged.
|
+ // reordering since the next activatable window in line will move up to the |
+ // front. Since the application window is still hidden at this time, it is |
+ // not yet activatable and the window behind it will move to the front. |
+ if (wm::IsActiveWindow(app_proxy->GetWindow())) { |
+ // Delete the proxy window first and then move the new window to the top |
+ // of the stack, replacing the proxy window. |
+ Activity::Delete(app_proxy); |
+ window_list_provider->StackWindowFrontOf( |
+ GetWindow(), |
+ window_list_provider->GetWindowList().back()); |
oshima
2014/10/08 19:02:30
If the app_proxy's window was active, shouldn't we
Mr4D (OOO till 08-26)
2014/10/08 23:48:16
A hidden window cannot be activated. As you have p
oshima
2014/10/09 04:53:32
Acknowledged.
|
+ } else { |
+ // The app window goes in front of the proxy window. |
+ window_list_provider->StackWindowFrontOf(GetWindow(), |
+ app_proxy->GetWindow()); |
+ Activity::Delete(app_proxy); |
oshima
2014/10/08 19:02:30
how about something like
bool was_active = wm::Is
Mr4D (OOO till 08-26)
2014/10/08 23:48:16
As stated above already - the window might neither
|
+ } |
+ // The proxy should now be deleted. |
DCHECK(!app_activity_registry_->unloaded_activity_proxy()); |
} |
} |
@@ -134,6 +150,10 @@ bool AppActivity::UsesFrame() const { |
} |
views::Widget* AppActivity::CreateWidget() { |
+ // Before we remove the proxy, we have to register the activity and |
+ // initialize its to move it to the proper activity list location. |
+ RegisterActivity(); |
+ Init(); |
// Make sure the content gets properly shown. |
if (current_state_ == ACTIVITY_VISIBLE) { |
HideContentProxy(); |
@@ -143,7 +163,6 @@ views::Widget* AppActivity::CreateWidget() { |
// If not previously specified, we change the state now to invisible.. |
SetCurrentState(ACTIVITY_INVISIBLE); |
} |
- RegisterActivity(); |
return web_view_->GetWidget(); |
} |