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

Unified Diff: athena/wm/split_view_controller.cc

Issue 574113004: [Athena] Fix switching activities by swiping from the right bezel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_split
Patch Set: Created 6 years, 3 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
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/split_view_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/wm/split_view_controller.cc
diff --git a/athena/wm/split_view_controller.cc b/athena/wm/split_view_controller.cc
index 4fc0c519b45cb7b38cdd09c0f4f831b2967c9cc7..40749c76eb2737105cfb7380a9f26b11a59a7d85 100644
--- a/athena/wm/split_view_controller.cc
+++ b/athena/wm/split_view_controller.cc
@@ -25,6 +25,7 @@
#include "ui/views/widget/root_view_targeter.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/window_util.h"
+#include "ui/wm/public/activation_client.h"
namespace athena {
@@ -177,7 +178,8 @@ bool SplitViewController::IsSplitViewModeActive() const {
}
void SplitViewController::ActivateSplitMode(aura::Window* left,
- aura::Window* right) {
+ aura::Window* right,
+ aura::Window* to_activate) {
const aura::Window::Windows& windows = window_list_provider_->GetWindowList();
aura::Window::Windows::const_reverse_iterator iter = windows.rbegin();
if (state_ == ACTIVE) {
@@ -211,11 +213,30 @@ void SplitViewController::ActivateSplitMode(aura::Window* left,
if (right_window_ && right_window_ != left && right_window_ != right)
to_hide_.push_back(right_window_);
+ left_window_ = left;
+ right_window_ = right;
+
divider_position_ = GetDefaultDividerPosition();
SetState(ACTIVE);
- right_window_ = right;
- left_window_ = left;
UpdateLayout(true);
+
+ aura::client::ActivationClient* activation_client =
+ aura::client::GetActivationClient(container_->GetRootWindow());
+ aura::Window* active_window = activation_client->GetActiveWindow();
+ if (to_activate) {
+ CHECK(to_activate == left_window_ || to_activate == right_window_);
+ wm::ActivateWindow(to_activate);
+ } else if (active_window != left_window_ &&
+ active_window != right_window_) {
+ // A window which does not belong to an activity could be active.
+ wm::ActivateWindow(left_window_);
+ }
+ active_window = activation_client->GetActiveWindow();
+
+ if (active_window == left_window_)
+ window_list_provider_->StackWindowBehindTo(right_window_, left_window_);
+ else
+ window_list_provider_->StackWindowBehindTo(left_window_, right_window_);
}
void SplitViewController::ReplaceWindow(aura::Window* window,
@@ -226,12 +247,19 @@ void SplitViewController::ReplaceWindow(aura::Window* window,
CHECK(replace_with != left_window_ && replace_with != right_window_);
DCHECK(window_list_provider_->IsWindowInList(replace_with));
- if (window == left_window_)
+ aura::Window* not_replaced = NULL;
+ if (window == left_window_) {
left_window_ = replace_with;
- else
+ not_replaced = right_window_;
+ } else {
right_window_ = replace_with;
- wm::ActivateWindow(replace_with);
+ not_replaced = left_window_;
+ }
UpdateLayout(false);
+
+ wm::ActivateWindow(replace_with);
+ window_list_provider_->StackWindowBehindTo(not_replaced, replace_with);
+
window->SetTransform(gfx::Transform());
window->Hide();
}
@@ -367,8 +395,6 @@ void SplitViewController::UpdateLayout(bool animate) {
left_window_->Show();
right_window_->Show();
- window_list_provider_->MoveToFront(right_window_);
- window_list_provider_->MoveToFront(left_window_);
gfx::Transform divider_transform;
divider_transform.Translate(divider_position_, 0);
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/split_view_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698