summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tab_contents
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 17:44:40 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 17:44:40 +0000
commit65b541890c5a048796bd2fc9ac687f0bac02bebe (patch)
tree9a02ae860b48a53abb147bc6cd2141fc4210d4e1 /chrome/browser/views/tab_contents
parent56ec62a9dbeda39c379b31ebb48756e2f1bcedaf (diff)
downloadchromium_src-65b541890c5a048796bd2fc9ac687f0bac02bebe.zip
chromium_src-65b541890c5a048796bd2fc9ac687f0bac02bebe.tar.gz
chromium_src-65b541890c5a048796bd2fc9ac687f0bac02bebe.tar.bz2
Gets blocked popups to work on views/gtk. I had to fix a couple of
additional things here: . Avoid doing anything in OnSizeAllocation if the size hasn't changed. Because of how gtk works I was getting stuck in a loop if I OnSizeAllocate did anything if the size hadn't changed. . Applied similar shortcut to TabContentsViewGtk. . Made SimpleMenuModel only ask delegate for checked state if the item is a check. BUG=none TEST=none Review URL: http://codereview.chromium.org/261051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tab_contents')
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.cc35
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.h3
2 files changed, 10 insertions, 28 deletions
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
index ad274b3..7cb7bdb 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
@@ -13,7 +13,6 @@
#include "base/gfx/rect.h"
#include "base/gfx/size.h"
#include "build/build_config.h"
-#include "chrome/browser/blocked_popup_container.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/gtk/tab_contents_drag_source.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -23,6 +22,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/browser/tab_contents/web_drag_dest_gtk.h"
+#include "chrome/browser/views/blocked_popup_container_view_views.h"
#include "chrome/browser/views/sad_tab_view.h"
#include "chrome/browser/views/tab_contents/render_view_context_menu_win.h"
#include "views/focus/view_storage.h"
@@ -341,7 +341,11 @@ gboolean TabContentsViewGtk::OnButtonPress(GtkWidget* widget,
void TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget,
GtkAllocation* allocation) {
- WasSized(gfx::Size(allocation->width, allocation->height));
+ gfx::Size new_size(allocation->width, allocation->height);
+ if (new_size == size_)
+ return;
+
+ WasSized(new_size);
}
void TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) {
@@ -366,6 +370,7 @@ void TabContentsViewGtk::WasShown() {
}
void TabContentsViewGtk::WasSized(const gfx::Size& size) {
+ size_ = size;
if (tab_contents()->interstitial_page())
tab_contents()->interstitial_page()->SetSize(size);
if (tab_contents()->render_widget_host_view())
@@ -374,29 +379,3 @@ void TabContentsViewGtk::WasSized(const gfx::Size& size) {
// TODO(brettw) this function can probably be moved to this class.
tab_contents()->RepositionSupressedPopupsToFit();
}
-
-// TODO(port): port BlockedPopupContainerViewWin...
-
-class BlockedPopupContainerViewGtk : public BlockedPopupContainerView {
- public:
- BlockedPopupContainerViewGtk() {}
- virtual ~BlockedPopupContainerViewGtk() {}
-
- // Overridden from BlockedPopupContainerView:
- virtual void SetPosition() {}
- virtual void ShowView() {}
- virtual void UpdateLabel() {}
- virtual void HideView() {}
- virtual void Destroy() {
- delete this;
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewGtk);
-};
-
-// static
-BlockedPopupContainerView* BlockedPopupContainerView::Create(
- BlockedPopupContainer* container) {
- return new BlockedPopupContainerViewGtk;
-}
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
index 993992b..142c7b3 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
@@ -98,6 +98,9 @@ class TabContentsViewGtk : public TabContentsView,
// GTK.
scoped_ptr<WebDragDestGtk> drag_dest_;
+ // Current size. See comment in WidgetGtk as to why this is cached.
+ gfx::Size size_;
+
DISALLOW_COPY_AND_ASSIGN(TabContentsViewGtk);
};