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

Unified Diff: mojo/services/view_manager/focus_controller.h

Issue 1092033003: Pulls display related changes from mojo to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « mojo/services/view_manager/connection_manager.cc ('k') | mojo/services/view_manager/focus_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/focus_controller.h
diff --git a/mojo/services/view_manager/focus_controller.h b/mojo/services/view_manager/focus_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..3bdd060ff3c6ba81a5d551775bd9924b289abba5
--- /dev/null
+++ b/mojo/services/view_manager/focus_controller.h
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_VIEW_MANAGER_FOCUS_CONTROLLER_H_
+#define SERVICES_VIEW_MANAGER_FOCUS_CONTROLLER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/services/view_manager/server_view_drawn_tracker_observer.h"
+
+namespace view_manager {
+
+class FocusControllerDelegate;
+class ServerView;
+class ServerViewDrawnTracker;
+
+// Tracks a focused view. Focus is moved to another view when the drawn state
+// of the focused view changes and the delegate is notified.
+class FocusController : public ServerViewDrawnTrackerObserver {
+ public:
+ FocusController(FocusControllerDelegate* delegate, ServerView* root);
+ ~FocusController() override;
+
+ // Sets the focused view. Does nothing if |view| is currently focused. This
+ // does not notify the delegate.
+ void SetFocusedView(ServerView* view);
+ ServerView* GetFocusedView();
+
+ private:
+ // Describes the source of the change.
+ enum ChangeSource {
+ CHANGE_SOURCE_EXPLICIT,
+ CHANGE_SOURCE_DRAWN_STATE_CHANGED,
+ };
+
+ // Implementation of SetFocusedView().
+ void SetFocusedViewImpl(ServerView* view, ChangeSource change_source);
+
+ // ServerViewDrawnTrackerObserver:
+ void OnDrawnStateChanged(ServerView* ancestor,
+ ServerView* view,
+ bool is_drawn) override;
+
+ FocusControllerDelegate* delegate_;
+ ServerView* root_;
+ scoped_ptr<ServerViewDrawnTracker> drawn_tracker_;
+
+ DISALLOW_COPY_AND_ASSIGN(FocusController);
+};
+
+} // namespace view_manager
+
+#endif // SERVICES_VIEW_MANAGER_FOCUS_CONTROLLER_H_
« no previous file with comments | « mojo/services/view_manager/connection_manager.cc ('k') | mojo/services/view_manager/focus_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698