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

Unified Diff: mojo/services/window_manager/focus_controller.cc

Issue 737913002: Dispatch key events to the currently focused window. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Redo FocusController storage so that it is a local property on a view. Created 6 years, 1 month 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 | « mojo/services/window_manager/focus_controller.h ('k') | mojo/services/window_manager/view_targeter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/window_manager/focus_controller.cc
diff --git a/mojo/services/window_manager/focus_controller.cc b/mojo/services/window_manager/focus_controller.cc
index ac24ade8aac308eeee2c71ab62c696922666a33d..7c5119560f9321fdada2be2b2cec242dcc6ccc92 100644
--- a/mojo/services/window_manager/focus_controller.cc
+++ b/mojo/services/window_manager/focus_controller.cc
@@ -5,6 +5,7 @@
#include "mojo/services/window_manager/focus_controller.h"
#include "base/auto_reset.h"
+#include "mojo/services/public/cpp/view_manager/view_property.h"
#include "mojo/services/public/cpp/view_manager/view_tracker.h"
#include "mojo/services/window_manager/focus_controller_observer.h"
#include "mojo/services/window_manager/focus_rules.h"
@@ -12,8 +13,14 @@
#include "mojo/services/window_manager/window_manager_app.h"
#include "ui/events/event.h"
+DECLARE_VIEW_PROPERTY_TYPE(mojo::FocusController*);
+
namespace mojo {
+namespace {
+DEFINE_VIEW_PROPERTY_KEY(FocusController*, kRootViewFocusController, nullptr);
+} // namespace
+
FocusController::FocusController(scoped_ptr<FocusRules> rules)
: active_view_(nullptr),
focused_view_(nullptr),
@@ -298,4 +305,16 @@ void FocusController::ViewFocusedFromInputEvent(View* view) {
FocusView(view);
}
+void SetFocusController(View* root_view, FocusController* focus_controller) {
+ DCHECK_EQ(root_view->GetRoot(), root_view);
+ root_view->SetLocalProperty(kRootViewFocusController, focus_controller);
+}
+
+FocusController* GetFocusController(View* root_view) {
+ if (root_view)
+ DCHECK_EQ(root_view->GetRoot(), root_view);
+ return root_view ?
+ root_view->GetLocalProperty(kRootViewFocusController) : nullptr;
+}
+
} // namespace mojo
« no previous file with comments | « mojo/services/window_manager/focus_controller.h ('k') | mojo/services/window_manager/view_targeter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698