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

Unified Diff: chrome/browser/ui/gtk/constrained_window_gtk.cc

Issue 7880003: content: Move constrained window code from TabContents to TabContentsWrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix views merge part 2 Created 9 years, 3 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
Index: chrome/browser/ui/gtk/constrained_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.cc b/chrome/browser/ui/gtk/constrained_window_gtk.cc
index 01cc99bffe3cc4420489f1dafa0cff6654df30f1..a769891b0ea784fa1888855e7586859f4bf244c8 100644
--- a/chrome/browser/ui/gtk/constrained_window_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_window_gtk.cc
@@ -7,7 +7,9 @@
#include <gdk/gdkkeysyms.h>
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/browser/browser_thread.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "ui/base/gtk/gtk_hig_constants.h"
@@ -33,12 +35,12 @@ bool ConstrainedWindowGtkDelegate::ShouldHaveBorderPadding() const {
}
ConstrainedWindowGtk::ConstrainedWindowGtk(
- TabContents* owner, ConstrainedWindowGtkDelegate* delegate)
- : owner_(owner),
+ TabContentsWrapper* wrapper, ConstrainedWindowGtkDelegate* delegate)
+ : wrapper_(wrapper),
delegate_(delegate),
visible_(false),
factory_(this) {
- DCHECK(owner);
+ DCHECK(wrapper);
DCHECK(delegate);
GtkWidget* dialog = delegate->GetWidgetRoot();
@@ -77,7 +79,7 @@ ConstrainedWindowGtk::ConstrainedWindowGtk(
g_signal_connect(widget(), "hierarchy-changed",
G_CALLBACK(OnHierarchyChangedThunk), this);
- owner->AddConstrainedDialog(this);
+ wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this);
}
ConstrainedWindowGtk::~ConstrainedWindowGtk() {
@@ -98,7 +100,7 @@ void ConstrainedWindowGtk::CloseConstrainedWindow() {
if (visible_)
ContainingView()->RemoveConstrainedWindow(this);
delegate_->DeleteDelegate();
- owner_->WillClose(this);
+ wrapper_->constrained_window_tab_helper()->WillClose(this);
delete this;
}
@@ -110,15 +112,17 @@ void ConstrainedWindowGtk::FocusConstrainedWindow() {
// The user may have focused another tab. In this case do not grab focus
// until this tab is refocused.
- if ((!owner_->delegate() ||
- owner_->delegate()->ShouldFocusConstrainedWindow()) &&
+ ConstrainedWindowTabHelper* helper =
+ wrapper_->constrained_window_tab_helper();
+ if ((!helper->delegate() ||
+ helper->delegate()->ShouldFocusConstrainedWindow()) &&
gtk_util::IsWidgetAncestryVisible(focus_widget)) {
gtk_widget_grab_focus(focus_widget);
} else {
// TODO(estade): this define should not need to be here because this class
// should not be used on linux/views.
#if defined(TOOLKIT_GTK)
- static_cast<TabContentsViewGtk*>(owner_->view())->
+ static_cast<TabContentsViewGtk*>(wrapper_->view())->
SetFocusedWidget(focus_widget);
#endif
}
@@ -128,10 +132,10 @@ ConstrainedWindowGtk::TabContentsViewType*
ConstrainedWindowGtk::ContainingView() {
#if defined(TOOLKIT_VIEWS) && !defined(TOUCH_UI)
return static_cast<NativeTabContentsViewGtk*>(
- static_cast<TabContentsViewViews*>(owner_->view())->
+ static_cast<TabContentsViewViews*>(wrapper_->view())->
native_tab_contents_view());
#else
- return static_cast<TabContentsViewType*>(owner_->view());
+ return static_cast<TabContentsViewType*>(wrapper_->view());
#endif
}

Powered by Google App Engine
This is Rietveld 408576698