Index: chrome/browser/ui/gtk/extensions/shell_window_gtk.cc |
diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc |
index 268ae302e737a6bffb2edd14fb46558aeabf4e0a..d7edbff708cee6ded6e800b6ccec9b6111f482d7 100644 |
--- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc |
+++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc |
@@ -10,7 +10,6 @@ |
#include "chrome/browser/ui/gtk/gtk_util.h" |
#include "chrome/browser/ui/gtk/gtk_window_util.h" |
#include "chrome/browser/web_applications/web_app.h" |
-#include "chrome/common/extensions/draggable_region.h" |
#include "chrome/common/extensions/extension.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/render_widget_host_view.h" |
@@ -30,11 +29,12 @@ const int kDebounceTimeoutMilliseconds = 100; |
ShellWindowGtk::ShellWindowGtk(ShellWindow* shell_window, |
const ShellWindow::CreateParams& params) |
- : shell_window_(shell_window), |
+ : NativeShellWindow(params), |
+ shell_window_(shell_window), |
+ window_(NULL), |
state_(GDK_WINDOW_STATE_WITHDRAWN), |
is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()), |
- content_thinks_its_fullscreen_(false), |
- frameless_(params.frame == ShellWindow::CreateParams::FRAME_NONE) { |
+ content_thinks_its_fullscreen_(false) { |
window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
gfx::NativeView native_view = |
@@ -46,7 +46,7 @@ ShellWindowGtk::ShellWindowGtk(ShellWindow* shell_window, |
// This is done to avoid a WM "feature" where setting the window size to |
// the monitor size causes the WM to set the EWMH for full screen mode. |
- if (frameless_ && |
+ if (frameless() && |
gtk_window_util::BoundsMatchMonitorSize(window_, params.bounds)) { |
gtk_window_set_default_size( |
window_, params.bounds.width(), params.bounds.height() - 1); |
@@ -63,7 +63,7 @@ ShellWindowGtk::ShellWindowGtk(ShellWindow* shell_window, |
bounds_.set_origin(gfx::Point(x, y)); |
// Hide titlebar when {frame: 'none'} specified on ShellWindow. |
- if (frameless_) |
+ if (frameless()) |
gtk_window_set_decorated(window_, false); |
int min_width = params.minimum_size.width(); |
@@ -108,7 +108,7 @@ ShellWindowGtk::ShellWindowGtk(ShellWindow* shell_window, |
G_CALLBACK(OnConfigureThunk), this); |
g_signal_connect(window_, "window-state-event", |
G_CALLBACK(OnWindowStateThunk), this); |
- if (frameless_) { |
+ if (frameless()) { |
g_signal_connect(window_, "button-press-event", |
G_CALLBACK(OnButtonPressThunk), this); |
} |
@@ -287,8 +287,7 @@ gboolean ShellWindowGtk::OnWindowState(GtkWidget* sender, |
gboolean ShellWindowGtk::OnButtonPress(GtkWidget* widget, |
GdkEventButton* event) { |
- if (!draggable_region_.isEmpty() && |
- draggable_region_.contains(event->x, event->y)) { |
+ if (IsInsideDraggableRegions(event->x, event->y)) { |
if (event->button == 1) { |
if (GDK_BUTTON_PRESS == event->type) { |
if (!suppress_window_raise_) |
@@ -347,59 +346,6 @@ void ShellWindowGtk::HandleKeyboardEvent( |
// No-op. |
} |
-void ShellWindowGtk::UpdateDraggableRegions( |
- const std::vector<extensions::DraggableRegion>& regions) { |
- // Draggable region is not supported for non-frameless window. |
- if (!frameless_) |
- return; |
- |
- SkRegion draggable_region; |
- |
- // By default, the whole window is non-draggable. We need to explicitly |
- // include those draggable regions. |
- for (std::vector<extensions::DraggableRegion>::const_iterator iter = |
- regions.begin(); |
- iter != regions.end(); ++iter) { |
- const extensions::DraggableRegion& region = *iter; |
- draggable_region.op( |
- region.bounds.x(), |
- region.bounds.y(), |
- region.bounds.right(), |
- region.bounds.bottom(), |
- region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
- } |
- |
- draggable_region_ = draggable_region; |
-} |
- |
-void ShellWindowGtk::UpdateLegacyDraggableRegions( |
- const std::vector<extensions::DraggableRegion>& regions) { |
- // Draggable region is not supported for non-frameless window. |
- if (!frameless_) |
- return; |
- |
- SkRegion draggable_region; |
- |
- // By default, the whole window is draggable. |
- gfx::Rect bounds = GetBounds(); |
- draggable_region.op(0, 0, bounds.right(), bounds.bottom(), |
- SkRegion::kUnion_Op); |
- |
- // Exclude those designated as non-draggable. |
- for (std::vector<extensions::DraggableRegion>::const_iterator iter = |
- regions.begin(); |
- iter != regions.end(); ++iter) { |
- const extensions::DraggableRegion& region = *iter; |
- draggable_region.op(region.bounds.x(), |
- region.bounds.y(), |
- region.bounds.right(), |
- region.bounds.bottom(), |
- SkRegion::kDifference_Op); |
- } |
- |
- draggable_region_ = draggable_region; |
-} |
- |
// static |
NativeShellWindow* NativeShellWindow::Create( |
ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |