| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ |
| 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "mojo/services/view_manager/public/cpp/types.h" | 10 #include "mojo/services/view_manager/public/cpp/types.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 class View; | 13 class View; |
| 14 | 14 |
| 15 // Encapsulates a connection to the view manager service. | 15 // Encapsulates a connection to the view manager service. A unique connection |
| 16 // A unique connection is made for every unique embed path for an app. e.g. for | 16 // is made every time an app is embedded. |
| 17 // app B embed by the following paths: A->B, A->C->B - there are two connections | |
| 18 // and thus two instances of this class. | |
| 19 class ViewManager { | 17 class ViewManager { |
| 20 public: | 18 public: |
| 21 // Returns the URL of the application that embedded this application. | 19 // Returns the URL of the application that embedded this application. |
| 22 virtual const std::string& GetEmbedderURL() const = 0; | 20 virtual const std::string& GetEmbedderURL() const = 0; |
| 23 | 21 |
| 24 // Returns the root of this connection. | 22 // Returns the root of this connection. |
| 25 virtual View* GetRoot() = 0; | 23 virtual View* GetRoot() = 0; |
| 26 | 24 |
| 27 // Returns a View known to this connection. | 25 // Returns a View known to this connection. |
| 28 virtual View* GetViewById(Id id) = 0; | 26 virtual View* GetViewById(Id id) = 0; |
| 29 | 27 |
| 30 // Returns the focused view; null if focus is not yet known or another app is | 28 // Returns the focused view; null if focus is not yet known or another app is |
| 31 // focused. | 29 // focused. |
| 32 virtual View* GetFocusedView() = 0; | 30 virtual View* GetFocusedView() = 0; |
| 33 | 31 |
| 32 // Creates and returns a new View (which is owned by the ViewManager). Views |
| 33 // are initially hidden, use SetVisible(true) to show. |
| 34 virtual View* CreateView() = 0; |
| 35 |
| 34 protected: | 36 protected: |
| 35 virtual ~ViewManager() {} | 37 virtual ~ViewManager() {} |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 } // namespace mojo | 40 } // namespace mojo |
| 39 | 41 |
| 40 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ | 42 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ |
| OLD | NEW |