#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/gtk/nav_button_provider_gtk.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "ui/base/glib/glib_cast.h"
#include "ui/base/glib/scoped_gobject.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_skia_source.h"
#include "ui/gtk/gtk_compat.h"
#include "ui/gtk/gtk_util.h"
#include "ui/linux/nav_button_provider.h"
#include "ui/views/widget/widget.h"
namespace gtk {
namespace {
struct NavButtonIcon { … };
const int kNavButtonIconSize = …;
const int kHeaderSpacing = …;
const char* ButtonStyleClassFromButtonType(
ui::NavButtonProvider::FrameButtonDisplayType type) { … }
GtkStateFlags GtkStateFlagsFromButtonState(
ui::NavButtonProvider::ButtonState state) { … }
const char* IconNameFromButtonType(
ui::NavButtonProvider::FrameButtonDisplayType type) { … }
gfx::Size LoadNavButtonIcon(ui::NavButtonProvider::FrameButtonDisplayType type,
GtkStyleContext* button_context,
int scale,
NavButtonIcon* icon = nullptr) { … }
gfx::Size GetMinimumWidgetSize(gfx::Size content_size,
GtkStyleContext* content_context,
GtkCssContext widget_context) { … }
GtkCssContext CreateHeaderContext(bool maximized) { … }
GtkCssContext CreateWindowControlsContext(bool maximized) { … }
void CalculateUnscaledButtonSize(
ui::NavButtonProvider::FrameButtonDisplayType type,
bool maximized,
gfx::Size* button_size,
gfx::Insets* button_margin) { … }
class NavButtonImageSource : public gfx::ImageSkiaSource { … };
}
NavButtonProviderGtk::NavButtonProviderGtk() = default;
NavButtonProviderGtk::~NavButtonProviderGtk() = default;
void NavButtonProviderGtk::RedrawImages(int top_area_height,
bool maximized,
bool active) { … }
gfx::ImageSkia NavButtonProviderGtk::GetImage(
ui::NavButtonProvider::FrameButtonDisplayType type,
ui::NavButtonProvider::ButtonState state) const { … }
gfx::Insets NavButtonProviderGtk::GetNavButtonMargin(
ui::NavButtonProvider::FrameButtonDisplayType type) const { … }
gfx::Insets NavButtonProviderGtk::GetTopAreaSpacing() const { … }
int NavButtonProviderGtk::GetInterNavButtonSpacing() const { … }
}