OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
6 | 6 |
7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
9 // badly with net::URLRequestStatus::Status. | 9 // badly with net::URLRequestStatus::Status. |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 int height = std::min(size.height(), kMaxWindowHeight); | 702 int height = std::min(size.height(), kMaxWindowHeight); |
703 if (IsPopup()) { | 703 if (IsPopup()) { |
704 // We're a popup, honor the size request. | 704 // We're a popup, honor the size request. |
705 gtk_widget_set_size_request(view_.get(), width, height); | 705 gtk_widget_set_size_request(view_.get(), width, height); |
706 } | 706 } |
707 | 707 |
708 // Update the size of the RWH. | 708 // Update the size of the RWH. |
709 if (requested_size_.width() != width || | 709 if (requested_size_.width() != width || |
710 requested_size_.height() != height) { | 710 requested_size_.height() != height) { |
711 requested_size_ = gfx::Size(width, height); | 711 requested_size_ = gfx::Size(width, height); |
| 712 host_->SendScreenRects(); |
712 host_->WasResized(); | 713 host_->WasResized(); |
713 } | 714 } |
714 } | 715 } |
715 | 716 |
716 void RenderWidgetHostViewGtk::SetBounds(const gfx::Rect& rect) { | 717 void RenderWidgetHostViewGtk::SetBounds(const gfx::Rect& rect) { |
717 // This is called when webkit has sent us a Move message. | 718 // This is called when webkit has sent us a Move message. |
718 if (IsPopup()) { | 719 if (IsPopup()) { |
719 gtk_window_move(GTK_WINDOW(gtk_widget_get_toplevel(view_.get())), | 720 gtk_window_move(GTK_WINDOW(gtk_widget_get_toplevel(view_.get())), |
720 rect.x(), rect.y()); | 721 rect.x(), rect.y()); |
721 } | 722 } |
722 | 723 |
723 SetSize(rect.size()); | 724 SetSize(rect.size()); |
| 725 host_->SendScreenRects(); |
724 } | 726 } |
725 | 727 |
726 gfx::NativeView RenderWidgetHostViewGtk::GetNativeView() const { | 728 gfx::NativeView RenderWidgetHostViewGtk::GetNativeView() const { |
727 return view_.get(); | 729 return view_.get(); |
728 } | 730 } |
729 | 731 |
730 gfx::NativeViewId RenderWidgetHostViewGtk::GetNativeViewId() const { | 732 gfx::NativeViewId RenderWidgetHostViewGtk::GetNativeViewId() const { |
731 return GtkNativeViewManager::GetInstance()->GetIdForWidget(view_.get()); | 733 return GtkNativeViewManager::GetInstance()->GetIdForWidget(view_.get()); |
732 } | 734 } |
733 | 735 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); | 978 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); |
977 im_context_.reset(new GtkIMContextWrapper(this)); | 979 im_context_.reset(new GtkIMContextWrapper(this)); |
978 plugin_container_manager_.set_host_widget(view_.get()); | 980 plugin_container_manager_.set_host_widget(view_.get()); |
979 key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get())); | 981 key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get())); |
980 } | 982 } |
981 | 983 |
982 void RenderWidgetHostViewGtk::DoPopupOrFullscreenInit(GtkWindow* window, | 984 void RenderWidgetHostViewGtk::DoPopupOrFullscreenInit(GtkWindow* window, |
983 const gfx::Rect& bounds) { | 985 const gfx::Rect& bounds) { |
984 requested_size_.SetSize(std::min(bounds.width(), kMaxWindowWidth), | 986 requested_size_.SetSize(std::min(bounds.width(), kMaxWindowWidth), |
985 std::min(bounds.height(), kMaxWindowHeight)); | 987 std::min(bounds.height(), kMaxWindowHeight)); |
| 988 host_->SendScreenRects(); |
986 host_->WasResized(); | 989 host_->WasResized(); |
987 | 990 |
988 ui::ActiveWindowWatcherX::AddObserver(this); | 991 ui::ActiveWindowWatcherX::AddObserver(this); |
989 | 992 |
990 // Don't set the size when we're going fullscreen. This can confuse the | 993 // Don't set the size when we're going fullscreen. This can confuse the |
991 // window manager into thinking we're resizing a fullscreen window and | 994 // window manager into thinking we're resizing a fullscreen window and |
992 // therefore not fullscreen anymore. | 995 // therefore not fullscreen anymore. |
993 if (!is_fullscreen_) { | 996 if (!is_fullscreen_) { |
994 gtk_widget_set_size_request( | 997 gtk_widget_set_size_request( |
995 view_.get(), requested_size_.width(), requested_size_.height()); | 998 view_.get(), requested_size_.width(), requested_size_.height()); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 this)); | 1532 this)); |
1530 } | 1533 } |
1531 BrowserAccessibilityGtk* root = | 1534 BrowserAccessibilityGtk* root = |
1532 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1535 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
1533 | 1536 |
1534 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1537 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
1535 return root->GetAtkObject(); | 1538 return root->GetAtkObject(); |
1536 } | 1539 } |
1537 | 1540 |
1538 } // namespace content | 1541 } // namespace content |
OLD | NEW |