Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/i18n/icu_util.h" | 7 #include "base/i18n/icu_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "third_party/skia/include/core/SkXfermode.h" | 10 #include "third_party/skia/include/core/SkXfermode.h" |
| 11 #include "ui/aura/client/stacking_client.h" | |
| 11 #include "ui/aura/event.h" | 12 #include "ui/aura/event.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
| 17 #include "ui/base/ui_base_paths.h" | 18 #include "ui/base/ui_base_paths.h" |
| 18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 19 #include "ui/gfx/compositor/test/compositor_test_support.h" | 20 #include "ui/gfx/compositor/test/compositor_test_support.h" |
| 20 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 virtual void OnWindowDestroying() OVERRIDE {} | 65 virtual void OnWindowDestroying() OVERRIDE {} |
| 65 virtual void OnWindowDestroyed() OVERRIDE {} | 66 virtual void OnWindowDestroyed() OVERRIDE {} |
| 66 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE {} | 67 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE {} |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 SkColor color_; | 70 SkColor color_; |
| 70 | 71 |
| 71 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); | 72 DISALLOW_COPY_AND_ASSIGN(DemoWindowDelegate); |
| 72 }; | 73 }; |
| 73 | 74 |
| 75 class StackingClientImpl : public aura::client::StackingClient { | |
|
Ben Goodger (Google)
2012/03/12 16:35:33
DemoStackingClient (a la DemoWindowDelegate, above
tfarina
2012/03/12 17:36:04
Done.
| |
| 76 public: | |
| 77 explicit StackingClientImpl(aura::RootWindow* root_window) | |
| 78 : root_window_(root_window) { | |
| 79 aura::client::SetStackingClient(this); | |
| 80 } | |
| 81 | |
| 82 virtual ~StackingClientImpl() { | |
| 83 aura::client::SetStackingClient(NULL); | |
| 84 } | |
| 85 | |
| 86 // Overridden from aura::client::StackingClient: | |
| 87 virtual aura::Window* GetDefaultParent(aura::Window* window) OVERRIDE { | |
| 88 return root_window_; | |
| 89 } | |
| 90 | |
| 91 private: | |
| 92 aura::RootWindow* root_window_; | |
| 93 | |
| 94 DISALLOW_COPY_AND_ASSIGN(StackingClientImpl); | |
| 95 }; | |
| 74 | 96 |
| 75 } // namespace | 97 } // namespace |
| 76 | 98 |
| 77 int main(int argc, char** argv) { | 99 int main(int argc, char** argv) { |
| 78 CommandLine::Init(argc, argv); | 100 CommandLine::Init(argc, argv); |
| 79 | 101 |
| 80 // The exit manager is in charge of calling the dtors of singleton objects. | 102 // The exit manager is in charge of calling the dtors of singleton objects. |
| 81 base::AtExitManager exit_manager; | 103 base::AtExitManager exit_manager; |
| 82 | 104 |
| 83 ui::RegisterPathProvider(); | 105 ui::RegisterPathProvider(); |
| 84 icu_util::Initialize(); | 106 icu_util::Initialize(); |
| 85 ResourceBundle::InitSharedInstanceWithLocale("en-US"); | 107 ResourceBundle::InitSharedInstanceWithLocale("en-US"); |
| 86 | 108 |
| 87 // Create the message-loop here before creating the root window. | 109 // Create the message-loop here before creating the root window. |
| 88 MessageLoop message_loop(MessageLoop::TYPE_UI); | 110 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 89 ui::CompositorTestSupport::Initialize(); | 111 ui::CompositorTestSupport::Initialize(); |
| 90 | 112 |
| 91 scoped_ptr<aura::RootWindow> root_window(new aura::RootWindow); | 113 scoped_ptr<aura::RootWindow> root_window(new aura::RootWindow); |
| 114 scoped_ptr<StackingClientImpl> stacking_client(new StackingClientImpl( | |
| 115 root_window.get())); | |
| 92 | 116 |
| 93 // Create a hierarchy of test windows. | 117 // Create a hierarchy of test windows. |
| 94 DemoWindowDelegate window_delegate1(SK_ColorBLUE); | 118 DemoWindowDelegate window_delegate1(SK_ColorBLUE); |
| 95 aura::Window window1(&window_delegate1); | 119 aura::Window window1(&window_delegate1); |
| 96 window1.set_id(1); | 120 window1.set_id(1); |
| 97 window1.Init(ui::Layer::LAYER_TEXTURED); | 121 window1.Init(ui::Layer::LAYER_TEXTURED); |
| 98 window1.SetBounds(gfx::Rect(100, 100, 400, 400)); | 122 window1.SetBounds(gfx::Rect(100, 100, 400, 400)); |
| 99 window1.Show(); | 123 window1.Show(); |
| 100 window1.SetParent(NULL); | 124 window1.SetParent(NULL); |
| 101 | 125 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 115 window3.Show(); | 139 window3.Show(); |
| 116 window3.SetParent(&window2); | 140 window3.SetParent(&window2); |
| 117 | 141 |
| 118 root_window->ShowRootWindow(); | 142 root_window->ShowRootWindow(); |
| 119 MessageLoopForUI::current()->Run(); | 143 MessageLoopForUI::current()->Run(); |
| 120 | 144 |
| 121 ui::CompositorTestSupport::Terminate(); | 145 ui::CompositorTestSupport::Terminate(); |
| 122 | 146 |
| 123 return 0; | 147 return 0; |
| 124 } | 148 } |
| OLD | NEW |