| 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 #ifndef UI_VIEWS_BACKGROUND_H_ | 5 #ifndef UI_VIEWS_BACKGROUND_H_ |
| 6 #define UI_VIEWS_BACKGROUND_H_ | 6 #define UI_VIEWS_BACKGROUND_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/native_theme/native_theme.h" |
| 15 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
| 16 | 17 |
| 17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 18 #include <windows.h> | 19 #include <windows.h> |
| 19 #endif // defined(OS_WIN) | 20 #endif // defined(OS_WIN) |
| 20 | 21 |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 class Canvas; | 23 class Canvas; |
| 23 } | 24 } |
| 24 | 25 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 40 // | 41 // |
| 41 ///////////////////////////////////////////////////////////////////////////// | 42 ///////////////////////////////////////////////////////////////////////////// |
| 42 class VIEWS_EXPORT Background { | 43 class VIEWS_EXPORT Background { |
| 43 public: | 44 public: |
| 44 Background(); | 45 Background(); |
| 45 virtual ~Background(); | 46 virtual ~Background(); |
| 46 | 47 |
| 47 // Creates a background that fills the canvas in the specified color. | 48 // Creates a background that fills the canvas in the specified color. |
| 48 static Background* CreateSolidBackground(SkColor color); | 49 static Background* CreateSolidBackground(SkColor color); |
| 49 | 50 |
| 51 // Creates a background that fills the canvas in the color specified by the |
| 52 // view's NativeTheme and the given color identifier. |
| 53 static Background* CreateThemedSolidBackground( |
| 54 View* view, |
| 55 ui::NativeTheme::ColorId color_id); |
| 56 |
| 50 // Creates a background that fills the canvas in the specified color. | 57 // Creates a background that fills the canvas in the specified color. |
| 51 static Background* CreateSolidBackground(int r, int g, int b) { | 58 static Background* CreateSolidBackground(int r, int g, int b) { |
| 52 return CreateSolidBackground(SkColorSetRGB(r, g, b)); | 59 return CreateSolidBackground(SkColorSetRGB(r, g, b)); |
| 53 } | 60 } |
| 54 | 61 |
| 55 // Creates a background that fills the canvas in the specified color. | 62 // Creates a background that fills the canvas in the specified color. |
| 56 static Background* CreateSolidBackground(int r, int g, int b, int a) { | 63 static Background* CreateSolidBackground(int r, int g, int b, int a) { |
| 57 return CreateSolidBackground(SkColorSetARGB(a, r, g, b)); | 64 return CreateSolidBackground(SkColorSetARGB(a, r, g, b)); |
| 58 } | 65 } |
| 59 | 66 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 78 | 85 |
| 79 private: | 86 private: |
| 80 SkColor color_; | 87 SkColor color_; |
| 81 | 88 |
| 82 DISALLOW_COPY_AND_ASSIGN(Background); | 89 DISALLOW_COPY_AND_ASSIGN(Background); |
| 83 }; | 90 }; |
| 84 | 91 |
| 85 } // namespace views | 92 } // namespace views |
| 86 | 93 |
| 87 #endif // UI_VIEWS_BACKGROUND_H_ | 94 #endif // UI_VIEWS_BACKGROUND_H_ |
| OLD | NEW |