| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ |
| 6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ | 6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" | 14 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" |
| 15 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h" | 15 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h" |
| 16 #include "chrome/browser/ui/libgtk2ui/libgtk2ui_export.h" | 16 #include "chrome/browser/ui/libgtk2ui/libgtk2ui_export.h" |
| 17 #include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h" | 17 #include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h" |
| 18 #include "ui/gfx/color_utils.h" | 18 #include "ui/gfx/color_utils.h" |
| 19 #include "ui/gfx/geometry/insets.h" | 19 #include "ui/gfx/geometry/insets.h" |
| 20 #include "ui/views/linux_ui/linux_ui.h" | 20 #include "ui/views/linux_ui/linux_ui.h" |
| 21 #include "ui/views/window/frame_buttons.h" | 21 #include "ui/views/window/frame_buttons.h" |
| 22 #include "ui/wm/public/text_edit_key_bindings_delegate_x11.h" |
| 22 | 23 |
| 23 typedef struct _GdkColor GdkColor; | 24 typedef struct _GdkColor GdkColor; |
| 24 typedef struct _GtkBorder GtkBorder; | 25 typedef struct _GtkBorder GtkBorder; |
| 25 typedef struct _GtkStyle GtkStyle; | 26 typedef struct _GtkStyle GtkStyle; |
| 26 typedef struct _GtkWidget GtkWidget; | 27 typedef struct _GtkWidget GtkWidget; |
| 27 | 28 |
| 28 class SkBitmap; | 29 class SkBitmap; |
| 29 | 30 |
| 30 namespace gfx { | 31 namespace gfx { |
| 31 class Image; | 32 class Image; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace libgtk2ui { | 35 namespace libgtk2ui { |
| 35 class Gtk2Border; | 36 class Gtk2Border; |
| 37 class Gtk2KeyBindingsHandler; |
| 36 class Gtk2SignalRegistrar; | 38 class Gtk2SignalRegistrar; |
| 37 class GConfTitlebarListener; | 39 class GConfTitlebarListener; |
| 38 | 40 |
| 39 // Interface to GTK2 desktop features. | 41 // Interface to GTK2 desktop features. |
| 40 // | 42 // |
| 41 class Gtk2UI : public views::LinuxUI { | 43 class Gtk2UI : public views::LinuxUI { |
| 42 public: | 44 public: |
| 43 Gtk2UI(); | 45 Gtk2UI(); |
| 44 virtual ~Gtk2UI(); | 46 virtual ~Gtk2UI(); |
| 45 | 47 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 views::WindowButtonOrderObserver* observer) OVERRIDE; | 105 views::WindowButtonOrderObserver* observer) OVERRIDE; |
| 104 virtual void RemoveWindowButtonOrderObserver( | 106 virtual void RemoveWindowButtonOrderObserver( |
| 105 views::WindowButtonOrderObserver* observer) OVERRIDE; | 107 views::WindowButtonOrderObserver* observer) OVERRIDE; |
| 106 virtual void AddNativeThemeChangeObserver( | 108 virtual void AddNativeThemeChangeObserver( |
| 107 views::NativeThemeChangeObserver* observer) OVERRIDE; | 109 views::NativeThemeChangeObserver* observer) OVERRIDE; |
| 108 virtual void RemoveNativeThemeChangeObserver( | 110 virtual void RemoveNativeThemeChangeObserver( |
| 109 views::NativeThemeChangeObserver* observer) OVERRIDE; | 111 views::NativeThemeChangeObserver* observer) OVERRIDE; |
| 110 virtual bool UnityIsRunning() OVERRIDE; | 112 virtual bool UnityIsRunning() OVERRIDE; |
| 111 virtual void NotifyWindowManagerStartupComplete() OVERRIDE; | 113 virtual void NotifyWindowManagerStartupComplete() OVERRIDE; |
| 112 | 114 |
| 115 // ui::wm::TextEditKeybindingDelegate: |
| 116 virtual bool MatchEvent( |
| 117 const ui::Event& event, |
| 118 std::vector<ui::wm::TextEditCommandX11>* commands) OVERRIDE; |
| 119 |
| 113 private: | 120 private: |
| 114 typedef std::map<int, SkColor> ColorMap; | 121 typedef std::map<int, SkColor> ColorMap; |
| 115 typedef std::map<int, color_utils::HSL> TintMap; | 122 typedef std::map<int, color_utils::HSL> TintMap; |
| 116 typedef std::map<int, gfx::Image> ImageCache; | 123 typedef std::map<int, gfx::Image> ImageCache; |
| 117 | 124 |
| 118 // This method returns the colors webkit will use for the scrollbars. When no | 125 // This method returns the colors webkit will use for the scrollbars. When no |
| 119 // colors are specified by the GTK+ theme, this function averages of the | 126 // colors are specified by the GTK+ theme, this function averages of the |
| 120 // thumb part and of the track colors. | 127 // thumb part and of the track colors. |
| 121 void GetScrollbarColors(GdkColor* thumb_active_color, | 128 void GetScrollbarColors(GdkColor* thumb_active_color, |
| 122 GdkColor* thumb_inactive_color, | 129 GdkColor* thumb_inactive_color, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // Currently, the only source of window button configuration. This will | 235 // Currently, the only source of window button configuration. This will |
| 229 // change if we ever have to support XFCE's configuration system or KDE's. | 236 // change if we ever have to support XFCE's configuration system or KDE's. |
| 230 scoped_ptr<GConfTitlebarListener> titlebar_listener_; | 237 scoped_ptr<GConfTitlebarListener> titlebar_listener_; |
| 231 #endif // defined(USE_GCONF) | 238 #endif // defined(USE_GCONF) |
| 232 | 239 |
| 233 // If either of these vectors are non-empty, they represent the current | 240 // If either of these vectors are non-empty, they represent the current |
| 234 // window button configuration. | 241 // window button configuration. |
| 235 std::vector<views::FrameButton> leading_buttons_; | 242 std::vector<views::FrameButton> leading_buttons_; |
| 236 std::vector<views::FrameButton> trailing_buttons_; | 243 std::vector<views::FrameButton> trailing_buttons_; |
| 237 | 244 |
| 245 scoped_ptr<Gtk2KeyBindingsHandler> key_bindings_handler_; |
| 246 |
| 238 // Objects to notify when the window frame button order changes. | 247 // Objects to notify when the window frame button order changes. |
| 239 ObserverList<views::WindowButtonOrderObserver> observer_list_; | 248 ObserverList<views::WindowButtonOrderObserver> observer_list_; |
| 240 | 249 |
| 241 // Observers to notify when the theme state changes. | 250 // Observers to notify when the theme state changes. |
| 242 ObserverList<views::NativeThemeChangeObserver> theme_change_observers_; | 251 ObserverList<views::NativeThemeChangeObserver> theme_change_observers_; |
| 243 | 252 |
| 244 // Image cache of lazily created images. | 253 // Image cache of lazily created images. |
| 245 mutable ImageCache gtk_images_; | 254 mutable ImageCache gtk_images_; |
| 246 | 255 |
| 247 // Whether to use the Gtk2 version of the native theme. | 256 // Whether to use the Gtk2 version of the native theme. |
| 248 bool use_gtk_; | 257 bool use_gtk_; |
| 249 | 258 |
| 250 DISALLOW_COPY_AND_ASSIGN(Gtk2UI); | 259 DISALLOW_COPY_AND_ASSIGN(Gtk2UI); |
| 251 }; | 260 }; |
| 252 | 261 |
| 253 } // namespace libgtk2ui | 262 } // namespace libgtk2ui |
| 254 | 263 |
| 255 // Access point to the GTK2 desktop system. This should be the only symbol that | 264 // Access point to the GTK2 desktop system. This should be the only symbol that |
| 256 // is exported in the library; everything else should be used through the | 265 // is exported in the library; everything else should be used through the |
| 257 // interface, because eventually this .so will be loaded through dlopen at | 266 // interface, because eventually this .so will be loaded through dlopen at |
| 258 // runtime so our main binary can conditionally load GTK2 or GTK3 or EFL or | 267 // runtime so our main binary can conditionally load GTK2 or GTK3 or EFL or |
| 259 // QT or whatever. | 268 // QT or whatever. |
| 260 LIBGTK2UI_EXPORT views::LinuxUI* BuildGtk2UI(); | 269 LIBGTK2UI_EXPORT views::LinuxUI* BuildGtk2UI(); |
| 261 | 270 |
| 262 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ | 271 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UI_H_ |
| OLD | NEW |