| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class TestView : public views::View { | 77 class TestView : public views::View { |
| 78 public: | 78 public: |
| 79 TestView() : color_shifting_(false), color_(SK_ColorYELLOW) {} | 79 TestView() : color_shifting_(false), color_(SK_ColorYELLOW) {} |
| 80 virtual ~TestView() {} | 80 virtual ~TestView() {} |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 // Overridden from views::View: | 83 // Overridden from views::View: |
| 84 virtual void OnPaint(gfx::Canvas* canvas) { | 84 virtual void OnPaint(gfx::Canvas* canvas) { |
| 85 canvas->FillRectInt(color_, 0, 0, width(), height()); | 85 canvas->FillRect(color_, GetLocalBounds()); |
| 86 } | 86 } |
| 87 virtual bool OnMousePressed(const views::MouseEvent& event) { | 87 virtual bool OnMousePressed(const views::MouseEvent& event) { |
| 88 color_shifting_ = true; | 88 color_shifting_ = true; |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 virtual void OnMouseMoved(const views::MouseEvent& event) { | 91 virtual void OnMouseMoved(const views::MouseEvent& event) { |
| 92 if (color_shifting_) { | 92 if (color_shifting_) { |
| 93 color_ = SkColorSetRGB((SkColorGetR(color_) + 5) % 255, | 93 color_ = SkColorSetRGB((SkColorGetR(color_) + 5) % 255, |
| 94 SkColorGetG(color_), | 94 SkColorGetG(color_), |
| 95 SkColorGetB(color_)); | 95 SkColorGetB(color_)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 class TestWindowContents : public views::WidgetDelegateView { | 109 class TestWindowContents : public views::WidgetDelegateView { |
| 110 public: | 110 public: |
| 111 TestWindowContents() {} | 111 TestWindowContents() {} |
| 112 virtual ~TestWindowContents() {} | 112 virtual ~TestWindowContents() {} |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 // Overridden from views::View: | 115 // Overridden from views::View: |
| 116 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 116 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
| 117 canvas->FillRectInt(SK_ColorGRAY, 0, 0, width(), height()); | 117 canvas->FillRect(SK_ColorGRAY, GetLocalBounds()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Overridden from views::WidgetDelegateView: | 120 // Overridden from views::WidgetDelegateView: |
| 121 virtual string16 GetWindowTitle() const OVERRIDE { | 121 virtual string16 GetWindowTitle() const OVERRIDE { |
| 122 return ASCIIToUTF16("Test Window!"); | 122 return ASCIIToUTF16("Test Window!"); |
| 123 } | 123 } |
| 124 virtual View* GetContentsView() OVERRIDE { | 124 virtual View* GetContentsView() OVERRIDE { |
| 125 return this; | 125 return this; |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 contents, window2, gfx::Rect(120, 150, 200, 200)); | 182 contents, window2, gfx::Rect(120, 150, 200, 200)); |
| 183 views_window->Show(); | 183 views_window->Show(); |
| 184 | 184 |
| 185 aura::Desktop::GetInstance()->Run(); | 185 aura::Desktop::GetInstance()->Run(); |
| 186 | 186 |
| 187 delete aura::Desktop::GetInstance(); | 187 delete aura::Desktop::GetInstance(); |
| 188 | 188 |
| 189 return 0; | 189 return 0; |
| 190 } | 190 } |
| 191 | 191 |
| OLD | NEW |