Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: chrome/browser/ui/libgtkui/gtk_ui.h

Issue 2963033002: Linux UI: Dynamically respond to changes in the scale factor (Closed)
Patch Set: LinuxUI may not exist in test scenarios Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/gtk_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/gtk_ui.h
diff --git a/chrome/browser/ui/libgtkui/gtk_ui.h b/chrome/browser/ui/libgtkui/gtk_ui.h
index 627aab50a982d29a5d4841a2184dda3eba0764e7..aa622adfb9ab085f7c77935bc72b55b597ff4c6d 100644
--- a/chrome/browser/ui/libgtkui/gtk_ui.h
+++ b/chrome/browser/ui/libgtkui/gtk_ui.h
@@ -18,12 +18,14 @@
#include "ui/views/linux_ui/linux_ui.h"
#include "ui/views/window/frame_buttons.h"
+typedef struct _GParamSpec GParamSpec;
typedef struct _GtkStyle GtkStyle;
typedef struct _GtkWidget GtkWidget;
namespace libgtkui {
class Gtk2KeyBindingsHandler;
class GConfListener;
+class DeviceScaleFactorObserver;
// Interface to GTK2 desktop features.
//
@@ -97,6 +99,10 @@ class GtkUi : public views::LinuxUI {
bool UnityIsRunning() override;
NonClientMiddleClickAction GetNonClientMiddleClickAction() override;
void NotifyWindowManagerStartupComplete() override;
+ void AddDeviceScaleFactorObserver(
+ views::DeviceScaleFactorObserver* observer) override;
+ void RemoveDeviceScaleFactorObserver(
+ views::DeviceScaleFactorObserver* observer) override;
// ui::TextEditKeybindingDelegate:
bool MatchEvent(const ui::Event& event,
@@ -110,6 +116,12 @@ class GtkUi : public views::LinuxUI {
typedef std::map<int, SkColor> ColorMap;
typedef std::map<int, color_utils::HSL> TintMap;
+ CHROMEG_CALLBACK_1(GtkUi,
+ void,
+ OnDeviceScaleFactorMaybeChanged,
+ void*,
+ GParamSpec*);
+
// This method returns the colors webkit will use for the scrollbars. When no
// colors are specified by the GTK+ theme, this function averages of the
// thumb part and of the track colors.
@@ -129,9 +141,12 @@ class GtkUi : public views::LinuxUI {
bool GetChromeStyleColor(const char* sytle_property,
SkColor* ret_color) const;
+ float GetRawDeviceScaleFactor();
+
ui::NativeTheme* native_theme_;
- // A GtkWindow object with the class "ChromeGtkFrame".
+ // On Gtk2, A GtkWindow object with the class "ChromeGtkFrame". On
+ // Gtk3, a regular GtkWindow.
GtkWidget* fake_window_;
// Colors calculated by LoadGtkValues() that are given to the
@@ -171,7 +186,12 @@ class GtkUi : public views::LinuxUI {
std::unique_ptr<Gtk2KeyBindingsHandler> key_bindings_handler_;
// Objects to notify when the window frame button order changes.
- base::ObserverList<views::WindowButtonOrderObserver> observer_list_;
+ base::ObserverList<views::WindowButtonOrderObserver>
+ window_button_order_observer_list_;
+
+ // Objects to notify when the device scale factor changes.
+ base::ObserverList<views::DeviceScaleFactorObserver>
+ device_scale_factor_observer_list_;
// Whether we should lower the window on a middle click to the non client
// area.
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/gtk_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698