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

Side by Side Diff: ash/wm/system_background_controller.h

Issue 11273059: ash: Clean up system background layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply review feedback Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/session_state_controller_impl.cc ('k') | ash/wm/system_background_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_
6 #define ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_
7
8 #include <string>
9
10 #include "ash/ash_export.h"
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "third_party/skia/include/core/SkColor.h"
14 #include "ui/aura/root_window_observer.h"
15
16 namespace aura {
17 class RootWindow;
18 }
19
20 namespace ui {
21 class Layer;
22 }
23
24 namespace ash {
25 namespace internal {
26
27 // SystemBackgroundController manages a ui::Layer that's stacked at the bottom
28 // of an aura::RootWindow's children. It exists solely to obscure portions of
29 // the root layer that aren't covered by any other layers (e.g. before the
30 // desktop background image is loaded at startup, or when we scale down all of
31 // the other layers as part of a power-button or window-management animation).
32 // It should never be transformed or restacked.
33 class ASH_EXPORT SystemBackgroundController : public aura::RootWindowObserver {
34 public:
35 enum Content {
36 CONTENT_INVALID,
37
38 // Copy the contents of the host window. Useful when starting on X, where
39 // the host window can inherit content from the X root window -- with this,
40 // the compositor can continue drawing whatever was previously onscreen even
41 // while we're e.g. waiting for images to be loaded from disk.
42 CONTENT_COPY_FROM_HOST,
43
44 // Display a black screen.
45 CONTENT_BLACK,
46
47 #if defined(OS_CHROMEOS)
48 // Display a solid-color screen matching the background color used for the
49 // Chrome OS boot splash screen.
50 CONTENT_CHROME_OS_BOOT_COLOR,
51 #endif
52 };
53
54 SystemBackgroundController(aura::RootWindow* root_window,
55 Content initial_content);
56 virtual ~SystemBackgroundController();
57
58 void SetContent(Content new_content);
59
60 // aura::RootWindowObserver overrides:
61 virtual void OnRootWindowResized(const aura::RootWindow* root,
62 const gfx::Size& old_size) OVERRIDE;
63
64 private:
65 class HostContentLayerDelegate;
66
67 // Initializes |layer_| as a textured layer containing a copy of the host
68 // window's content.
69 void CreateTexturedLayerWithHostContent();
70
71 // Initializes |layer_| as a solid-color layer containing |color|.
72 void CreateColoredLayer(SkColor color);
73
74 // Updates |layer|'s bounds to match those of |root_window_|'s layer.
75 void UpdateLayerBounds(ui::Layer* layer);
76
77 // Adds |layer| to |root_window_|'s layer and stacks it at the bottom of all
78 // its children.
79 void AddLayerToRootLayer(ui::Layer* layer);
80
81 aura::RootWindow* root_window_; // not owned
82
83 // Type of content currently displayed in |layer_|.
84 Content content_;
85
86 // Paints |layer_| when |content_| is CONTENT_COPY_FROM_HOST.
87 scoped_ptr<HostContentLayerDelegate> layer_delegate_;
88
89 scoped_ptr<ui::Layer> layer_;
90
91 DISALLOW_COPY_AND_ASSIGN(SystemBackgroundController);
92 };
93
94 } // namespace internal
95 } // namespace ash
96
97 #endif // ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/wm/session_state_controller_impl.cc ('k') | ash/wm/system_background_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698