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

Unified Diff: mash/simple_wm/simple_wm.cc

Issue 2613613002: Hook up proper FocusController for simple_wm. (Closed)
Patch Set: Created 3 years, 12 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 | « mash/simple_wm/simple_wm.h ('k') | ui/views/window/custom_frame_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/simple_wm/simple_wm.cc
diff --git a/mash/simple_wm/simple_wm.cc b/mash/simple_wm/simple_wm.cc
index 92c0f6b5dc684ff0eaa233cb4e33c62e75cd9581..66f0a3b5bf4a92c36a024ba77c90d7e1215f73d3 100644
--- a/mash/simple_wm/simple_wm.cc
+++ b/mash/simple_wm/simple_wm.cc
@@ -19,7 +19,7 @@
#include "ui/views/widget/native_widget_aura.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
-#include "ui/wm/core/default_activation_client.h"
+#include "ui/wm/core/focus_controller.h"
namespace simple_wm {
@@ -341,6 +341,9 @@ class SimpleWM::DisplayLayoutManager : public aura::LayoutManager {
DISALLOW_COPY_AND_ASSIGN(DisplayLayoutManager);
};
+////////////////////////////////////////////////////////////////////////////////
+// SimpleWM, public:
+
SimpleWM::SimpleWM() {}
SimpleWM::~SimpleWM() {
@@ -355,6 +358,9 @@ SimpleWM::~SimpleWM() {
display::Screen::SetScreenInstance(nullptr);
}
+////////////////////////////////////////////////////////////////////////////////
+// SimpleWM, service_manager::Service implementation:
+
void SimpleWM::OnStart() {
CHECK(!started_);
started_ = true;
@@ -380,6 +386,9 @@ bool SimpleWM::OnConnect(
return true;
}
+////////////////////////////////////////////////////////////////////////////////
+// SimpleWM, aura::WindowTreeClientDelegate implementation:
+
void SimpleWM::OnEmbed(
std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) {
// WindowTreeClients configured as the window manager should never get
@@ -411,6 +420,9 @@ aura::PropertyConverter* SimpleWM::GetPropertyConverter() {
return &property_converter_;
}
+////////////////////////////////////////////////////////////////////////////////
+// SimpleWM, aura::WindowManagerDelegate implementation:
+
void SimpleWM::SetWindowManagerClient(
aura::WindowManagerClient* client) {
window_manager_client_ = client;
@@ -515,8 +527,10 @@ void SimpleWM::OnWmNewDisplay(
frame_decoration_values->max_title_bar_button_width = 0;
window_manager_client_->SetFrameDecorationValues(
std::move(frame_decoration_values));
- new wm::DefaultActivationClient(display_root_);
- aura::client::SetFocusClient(display_root_, &focus_client_);
+ focus_controller_ = base::MakeUnique<wm::FocusController>(this);
+ aura::client::SetFocusClient(display_root_, focus_controller_.get());
+ aura::client::SetActivationClient(display_root_, focus_controller_.get());
+ display_root_->AddPreTargetHandler(focus_controller_.get());
}
void SimpleWM::OnWmDisplayRemoved(
@@ -543,6 +557,29 @@ void SimpleWM::OnWmSetClientArea(
const gfx::Insets& insets,
const std::vector<gfx::Rect>& additional_client_areas) {}
+////////////////////////////////////////////////////////////////////////////////
+// SimpleWM, wm::BaseFocusRules implementation:
+
+bool SimpleWM::SupportsChildActivation(aura::Window* window) const {
+ return window == window_root_;
sky 2017/01/03 23:52:34 Shouldn't you only return true if window is in cli
Ben Goodger (Google) 2017/01/03 23:54:40 The window passed to this function is the parent o
sky 2017/01/04 00:09:58 Ah, got it.
+}
+
+bool SimpleWM::IsWindowConsideredVisibleForActivation(
+ aura::Window* window) const {
+ if (window->IsVisible())
+ return true;
+
+ ui::WindowShowState show_state =
+ window->GetProperty(aura::client::kShowStateKey);
+ if (show_state == ui::SHOW_STATE_MINIMIZED)
+ return true;
+
+ return window->TargetVisibility();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// SimpleWM, private:
+
SimpleWM::FrameView* SimpleWM::GetFrameViewForClientWindow(
aura::Window* client_window) {
auto it = client_window_to_frame_view_.find(client_window);
« no previous file with comments | « mash/simple_wm/simple_wm.h ('k') | ui/views/window/custom_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698