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_LINUX_UI_LINUX_UI_H_ | 5 #ifndef UI_VIEWS_LINUX_UI_LINUX_UI_H_ |
6 #define UI_LINUX_UI_LINUX_UI_H_ | 6 #define UI_VIEWS_LINUX_UI_LINUX_UI_H_ |
7 | 7 |
8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
9 #include "ui/linux_ui/linux_ui_export.h" | |
10 #include "ui/linux_ui/status_icon_linux.h" | |
11 #include "ui/shell_dialogs/linux_shell_dialog.h" | 9 #include "ui/shell_dialogs/linux_shell_dialog.h" |
| 10 #include "ui/views/linux_ui/status_icon_linux.h" |
| 11 #include "ui/views/views_export.h" |
12 | 12 |
13 // The main entrypoint into Linux toolkit specific code. GTK code should only | 13 // The main entrypoint into Linux toolkit specific code. GTK code should only |
14 // be executed behind this interface. | 14 // be executed behind this interface. |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Image; | 17 class Image; |
18 } | 18 } |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 class NativeTheme; | 21 class NativeTheme; |
| 22 } |
| 23 |
| 24 namespace views { |
22 | 25 |
23 // Adapter class with targets to render like different toolkits. Set by any | 26 // Adapter class with targets to render like different toolkits. Set by any |
24 // project that wants to do linux desktop native rendering. | 27 // project that wants to do linux desktop native rendering. |
25 // | 28 // |
26 // TODO(erg): We're hardcoding GTK2, when we'll need to have backends for (at | 29 // TODO(erg): We're hardcoding GTK2, when we'll need to have backends for (at |
27 // minimum) GTK2 and GTK3. LinuxUI::instance() should actually be a very | 30 // minimum) GTK2 and GTK3. LinuxUI::instance() should actually be a very |
28 // complex method that pokes around with dlopen against a libuigtk2.so, a | 31 // complex method that pokes around with dlopen against a libuigtk2.so, a |
29 // liuigtk3.so, etc. | 32 // liuigtk3.so, etc. |
30 // | 33 class VIEWS_EXPORT LinuxUI : public ui::LinuxShellDialog { |
31 // TODO(erg): This class should be folded into ui/views/ instead of living in | |
32 // its own component once we've deleted out the GTK+ port. | |
33 class LINUX_UI_EXPORT LinuxUI : public LinuxShellDialog { | |
34 public: | 34 public: |
35 virtual ~LinuxUI() {} | 35 virtual ~LinuxUI() {} |
36 | 36 |
37 // Sets the dynamically loaded singleton that draws the desktop native UI. | 37 // Sets the dynamically loaded singleton that draws the desktop native UI. |
38 static void SetInstance(LinuxUI* instance); | 38 static void SetInstance(LinuxUI* instance); |
39 | 39 |
40 // Returns a LinuxUI instance for the toolkit used in the user's desktop | 40 // Returns a LinuxUI instance for the toolkit used in the user's desktop |
41 // environment. | 41 // environment. |
42 // | 42 // |
43 // Can return NULL, in case no toolkit has been set. (For example, if we're | 43 // Can return NULL, in case no toolkit has been set. (For example, if we're |
44 // running with the "--ash" flag.) | 44 // running with the "--ash" flag.) |
45 static const LinuxUI* instance(); | 45 static const LinuxUI* instance(); |
46 | 46 |
47 // Returns an themed image per theme_provider.h | 47 // Returns an themed image per theme_provider.h |
48 virtual bool UseNativeTheme() const = 0; | 48 virtual bool UseNativeTheme() const = 0; |
49 virtual gfx::Image GetThemeImageNamed(int id) const = 0; | 49 virtual gfx::Image GetThemeImageNamed(int id) const = 0; |
50 virtual bool GetColor(int id, SkColor* color) const = 0; | 50 virtual bool GetColor(int id, SkColor* color) const = 0; |
51 virtual bool HasCustomImage(int id) const = 0; | 51 virtual bool HasCustomImage(int id) const = 0; |
52 | 52 |
53 // Returns a NativeTheme that will provide system colors and draw system | 53 // Returns a NativeTheme that will provide system colors and draw system |
54 // style widgets. | 54 // style widgets. |
55 virtual NativeTheme* GetNativeTheme() const = 0; | 55 virtual ui::NativeTheme* GetNativeTheme() const = 0; |
56 | 56 |
57 // Returns whether we should be using the native theme provided by this | 57 // Returns whether we should be using the native theme provided by this |
58 // object by default. | 58 // object by default. |
59 virtual bool GetDefaultUsesSystemTheme() const = 0; | 59 virtual bool GetDefaultUsesSystemTheme() const = 0; |
60 | 60 |
61 // Sets visual properties in the desktop environment related to download | 61 // Sets visual properties in the desktop environment related to download |
62 // progress, if available. | 62 // progress, if available. |
63 virtual void SetDownloadCount(int count) const = 0; | 63 virtual void SetDownloadCount(int count) const = 0; |
64 virtual void SetProgressFraction(float percentage) const = 0; | 64 virtual void SetProgressFraction(float percentage) const = 0; |
65 | 65 |
66 // Checks for platform support for status icons. | 66 // Checks for platform support for status icons. |
67 virtual bool IsStatusIconSupported() const = 0; | 67 virtual bool IsStatusIconSupported() const = 0; |
68 | 68 |
69 // Create a native status icon. | 69 // Create a native status icon. |
70 virtual scoped_ptr<StatusIconLinux> CreateLinuxStatusIcon( | 70 virtual scoped_ptr<StatusIconLinux> CreateLinuxStatusIcon( |
71 const gfx::ImageSkia& image, | 71 const gfx::ImageSkia& image, |
72 const string16& tool_tip) const = 0; | 72 const string16& tool_tip) const = 0; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace ui | 75 } // namespace views |
76 | 76 |
77 #endif // UI_LINUX_UI_LINUX_UI_H_ | 77 #endif // UI_VIEWS_LINUX_UI_LINUX_UI_H_ |
OLD | NEW |