11dda1f7ad87a571121a4ea91935d432d858fea4
[platform/framework/web/crosswalk.git] / src / athena / screen / public / screen_manager.h
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
3 // found in the LICENSE file.
4
5 #ifndef ATHENA_SCREEN_PUBLIC_SCREEN_MANAGER_H_
6 #define ATHENA_SCREEN_PUBLIC_SCREEN_MANAGER_H_
7
8 #include <string>
9
10 #include "athena/athena_export.h"
11 #include "ui/gfx/display.h"
12
13 namespace aura {
14 class Window;
15 }
16
17 namespace athena {
18 class ScreenManagerDelegate;
19
20 // Mananges basic UI components on the screen such as background, and provide
21 // API for other UI components, such as window manager, home card, to
22 // create and manage their windows on the screen.
23 class ATHENA_EXPORT ScreenManager {
24  public:
25   struct ContainerParams {
26     ContainerParams(const std::string& name, int z_order_priority);
27     std::string name;
28
29     // True if the container can activate its child window.
30     bool can_activate_children;
31
32     // True if the container will block evnets from containers behind it.
33     bool block_events;
34
35     // Defines the z_order priority of the container.
36     int z_order_priority;
37
38     // True if this container should be used as a default parent.
39     bool default_parent;
40
41     // The container priority used to open modal dialog window
42     // created with this container as a transient parent  (Note: A modal window
43     // should
44     // use a trnasient parent, not a direct parent, or no transient parent.)
45     //
46     // Default is -1, and it will fallback to the container behind this
47     // container,
48     // that has the modal container proiroty.
49     //
50     // The modal container for modal window is selected as follows.
51     // 1) a window must be created with |aura::client::kModalKey| property
52     //   without explicit parent set.
53     // 2.a) If aura::client::kAlwaysOnTopKey is NOT set, it uses the stand flow
54     //   described above. (fallback to containers behind this).
55     // 2.b) If aura::client::kAlwaysOnTopKey is set, it searches the top most
56     //   container which has |modal_container_priority| != -1.
57     // 3) Look for the container with |modal_container_priority|, and create
58     //   one if it doesn't exist.
59     //
60     // Created modal container will self destruct if last modal window
61     // is deleted.
62     int modal_container_priority;
63   };
64
65   // Creates, returns and deletes the singleton object of the ScreenManager
66   // implementation.
67   static ScreenManager* Create(aura::Window* root);
68   static ScreenManager* Get();
69   static void Shutdown();
70
71   virtual ~ScreenManager() {}
72
73   // Creates the container window on the screen.
74   virtual aura::Window* CreateContainer(const ContainerParams& params) = 0;
75
76   // Return the context object to be used for widget creation.
77   virtual aura::Window* GetContext() = 0;
78
79   // Set screen rotation.
80   // TODO(flackr): Extract and use ash DisplayManager to set rotation
81   // instead: http://crbug.com/401044.
82   virtual void SetRotation(gfx::Display::Rotation rotation) = 0;
83   virtual void SetRotationLocked(bool rotation_locked) = 0;
84 };
85
86 }  // namespace athena
87
88 #endif  // ATHENA_SCREEN_PUBLIC_SCREEN_MANAGER_H_