| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/message_loop/message_pump_gtk.h" | 10 #include "base/message_loop/message_pump_gtk.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 const ShellWindow::CreateParams& params) | 44 const ShellWindow::CreateParams& params) |
| 45 : shell_window_(shell_window), | 45 : shell_window_(shell_window), |
| 46 window_(NULL), | 46 window_(NULL), |
| 47 state_(GDK_WINDOW_STATE_WITHDRAWN), | 47 state_(GDK_WINDOW_STATE_WITHDRAWN), |
| 48 is_active_(false), | 48 is_active_(false), |
| 49 content_thinks_its_fullscreen_(false), | 49 content_thinks_its_fullscreen_(false), |
| 50 frameless_(params.frame == ShellWindow::FRAME_NONE), | 50 frameless_(params.frame == ShellWindow::FRAME_NONE), |
| 51 frame_cursor_(NULL), | 51 frame_cursor_(NULL), |
| 52 atom_cache_(base::MessagePumpGtk::GetDefaultXDisplay(), kAtomsToCache), | 52 atom_cache_(base::MessagePumpGtk::GetDefaultXDisplay(), kAtomsToCache), |
| 53 is_x_event_listened_(false) { | 53 is_x_event_listened_(false) { |
| 54 Observe(web_contents()); |
| 55 |
| 54 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | 56 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
| 55 | 57 |
| 56 gfx::NativeView native_view = | 58 gfx::NativeView native_view = |
| 57 web_contents()->GetView()->GetNativeView(); | 59 web_contents()->GetView()->GetNativeView(); |
| 58 gtk_container_add(GTK_CONTAINER(window_), native_view); | 60 gtk_container_add(GTK_CONTAINER(window_), native_view); |
| 59 | 61 |
| 60 if (params.bounds.x() != INT_MIN && params.bounds.y() != INT_MIN) | 62 if (params.bounds.x() != INT_MIN && params.bounds.y() != INT_MIN) |
| 61 gtk_window_move(window_, params.bounds.x(), params.bounds.y()); | 63 gtk_window_move(window_, params.bounds.x(), params.bounds.y()); |
| 62 | 64 |
| 63 // This is done to avoid a WM "feature" where setting the window size to | 65 // This is done to avoid a WM "feature" where setting the window size to |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 335 } |
| 334 | 336 |
| 335 void NativeAppWindowGtk::FlashFrame(bool flash) { | 337 void NativeAppWindowGtk::FlashFrame(bool flash) { |
| 336 gtk_window_set_urgency_hint(window_, flash); | 338 gtk_window_set_urgency_hint(window_, flash); |
| 337 } | 339 } |
| 338 | 340 |
| 339 bool NativeAppWindowGtk::IsAlwaysOnTop() const { | 341 bool NativeAppWindowGtk::IsAlwaysOnTop() const { |
| 340 return false; | 342 return false; |
| 341 } | 343 } |
| 342 | 344 |
| 343 void NativeAppWindowGtk::RenderViewHostChanged() { | 345 void NativeAppWindowGtk::RenderViewHostChanged( |
| 346 content::RenderViewHost* old_host, |
| 347 content::RenderViewHost* new_host) { |
| 344 web_contents()->GetView()->Focus(); | 348 web_contents()->GetView()->Focus(); |
| 345 } | 349 } |
| 346 | 350 |
| 347 gfx::Insets NativeAppWindowGtk::GetFrameInsets() const { | 351 gfx::Insets NativeAppWindowGtk::GetFrameInsets() const { |
| 348 if (frameless_) | 352 if (frameless_) |
| 349 return gfx::Insets(); | 353 return gfx::Insets(); |
| 350 GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_)); | 354 GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_)); |
| 351 if (!gdk_window) | 355 if (!gdk_window) |
| 352 return gfx::Insets(); | 356 return gfx::Insets(); |
| 353 | 357 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 } | 638 } |
| 635 | 639 |
| 636 void NativeAppWindowGtk::UpdateDraggableRegions( | 640 void NativeAppWindowGtk::UpdateDraggableRegions( |
| 637 const std::vector<extensions::DraggableRegion>& regions) { | 641 const std::vector<extensions::DraggableRegion>& regions) { |
| 638 // Draggable region is not supported for non-frameless window. | 642 // Draggable region is not supported for non-frameless window. |
| 639 if (!frameless_) | 643 if (!frameless_) |
| 640 return; | 644 return; |
| 641 | 645 |
| 642 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); | 646 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); |
| 643 } | 647 } |
| OLD | NEW |