diff options
-rw-r--r-- | chrome/browser/views/blocked_popup_container_view_win.cc (renamed from chrome/browser/views/blocked_popup_container_view_views.cc) | 254 | ||||
-rw-r--r-- | chrome/browser/views/blocked_popup_container_view_win.h (renamed from chrome/browser/views/blocked_popup_container_view_views.h) | 50 | ||||
-rw-r--r-- | chrome/browser/views/tab_contents/tab_contents_view_gtk.cc | 35 | ||||
-rw-r--r-- | chrome/browser/views/tab_contents/tab_contents_view_gtk.h | 3 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 6 | ||||
-rw-r--r-- | views/controls/menu/simple_menu_model.cc | 4 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 9 | ||||
-rw-r--r-- | views/widget/widget_gtk.h | 7 |
8 files changed, 133 insertions, 235 deletions
diff --git a/chrome/browser/views/blocked_popup_container_view_views.cc b/chrome/browser/views/blocked_popup_container_view_win.cc index 72f9796..00e4157 100644 --- a/chrome/browser/views/blocked_popup_container_view_views.cc +++ b/chrome/browser/views/blocked_popup_container_view_win.cc @@ -2,37 +2,26 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. -#include "chrome/browser/views/blocked_popup_container_view_views.h" +#include "chrome/browser/views/blocked_popup_container_view_win.h" #include <math.h> -#if defined(OS_WIN) #include <windows.h> -#endif #include "app/gfx/canvas.h" #include "app/gfx/path.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/string_util.h" -#include "base/utf_string_conversions.h" +#include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "views/background.h" #include "views/controls/button/image_button.h" -#include "views/controls/button/menu_button.h" -#include "views/controls/menu/menu_2.h" -#include "views/controls/menu/simple_menu_model.h" -#include "views/controls/scrollbar/native_scroll_bar.h" -#include "views/screen.h" -#if defined(OS_WIN) -#include "views/widget/widget_win.h" -#elif defined(OS_LINUX) -#include "views/widget/widget_gtk.h" -#endif +#include "views/controls/scrollbar/native_scroll_bar.h" namespace { // The minimal border around the edge of the notification. @@ -74,124 +63,15 @@ const SkScalar kRoundedCornerRad[8] = { } // namespace -#if defined(OS_WIN) - -// BlockedPopupContainerViewWidget Win ---------------------------------------- - -class BlockedPopupContainerViewWidget : public views::WidgetWin { - public: - BlockedPopupContainerViewWidget(BlockedPopupContainerViewViews* container, - gfx::NativeView parent); - - void SetBoundsAndShow(const gfx::Rect& bounds); - void Show(); - void Hide(); - - // Returns the size of our parent. - gfx::Size GetParentSize(); - - private: - virtual void OnSize(UINT param, const CSize& size); - - BlockedPopupContainerViewViews* container_; - - DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewWidget); -}; - -BlockedPopupContainerViewWidget::BlockedPopupContainerViewWidget( - BlockedPopupContainerViewViews* container, gfx::NativeView parent) - : container_(container) { - set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); - WidgetWin::Init(parent, gfx::Rect()); -} - -void BlockedPopupContainerViewWidget::SetBoundsAndShow( - const gfx::Rect& bounds) { - SetWindowPos(HWND_TOP, bounds.x(), bounds.y(), bounds.width(), - bounds.height(), SWP_SHOWWINDOW); -} - -void BlockedPopupContainerViewWidget::Show() { - SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); -} - -void BlockedPopupContainerViewWidget::Hide() { - SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); -} - -gfx::Size BlockedPopupContainerViewWidget::GetParentSize() { - HWND parent = GetParent(); - RECT client_rect; - ::GetClientRect(parent, &client_rect); - return gfx::Size(client_rect.right - client_rect.left, - client_rect.bottom - client_rect.top); -} - -void BlockedPopupContainerViewWidget::OnSize(UINT param, const CSize& size) { - container_->UpdateWidgetShape(this, gfx::Size(size.cx, size.cy)); - - ChangeSize(param, size); -} - -#elif defined(OS_LINUX) - -// BlockedPopupContainerViewWidget GTK ---------------------------------------- -class BlockedPopupContainerViewWidget : public views::WidgetGtk { - public: - BlockedPopupContainerViewWidget(BlockedPopupContainerViewViews* container, - gfx::NativeView parent); - - void SetBoundsAndShow(const gfx::Rect& bounds); - - // Returns the size of our parent. - gfx::Size GetParentSize(); - - private: - virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); - - BlockedPopupContainerViewViews* container_; - - DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewWidget); -}; - -BlockedPopupContainerViewWidget::BlockedPopupContainerViewWidget( - BlockedPopupContainerViewViews* container, - gfx::NativeView parent) - : views::WidgetGtk(views::WidgetGtk::TYPE_CHILD), - container_(container) { - WidgetGtk::Init(parent, gfx::Rect()); -} - -void BlockedPopupContainerViewWidget::SetBoundsAndShow( - const gfx::Rect& bounds) { - SetBounds(bounds); - Show(); -} - -gfx::Size BlockedPopupContainerViewWidget::GetParentSize() { - GtkWidget* parent = gtk_widget_get_parent(GetNativeView()); - return gfx::Size(parent->allocation.width, parent->allocation.height); -} - -void BlockedPopupContainerViewWidget::OnSizeAllocate( - GtkWidget* widget, GtkAllocation* allocation) { - WidgetGtk::OnSizeAllocate(widget, allocation); - container_->UpdateWidgetShape( - this, gfx::Size(allocation->width, allocation->height)); -} - -#endif - -// BlockedPopupContainerInternalView ------------------------------------------ // The view presented to the user notifying them of the number of popups // blocked. This view should only be used inside of BlockedPopupContainer. class BlockedPopupContainerInternalView : public views::View, public views::ButtonListener, - public views::SimpleMenuModel::Delegate { + public views::Menu::Delegate { public: explicit BlockedPopupContainerInternalView( - BlockedPopupContainerViewViews* container); + BlockedPopupContainerViewWin* container); ~BlockedPopupContainerInternalView(); // Sets the label on the menu button. @@ -211,21 +91,16 @@ class BlockedPopupContainerInternalView : public views::View, // Overridden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, const views::Event& event); - // Overridden from SimpleMenuModel::Delegate: + // Overridden from Menu::Delegate: // Displays the status of the "Show Blocked Popup Notification" item. - virtual bool IsCommandIdChecked(int id) const; - virtual bool IsCommandIdEnabled(int id) const { return true; } - virtual bool GetAcceleratorForCommandId(int command_id, - views::Accelerator* accelerator) { - return false; - } + virtual bool IsItemChecked(int id) const; // Called after user clicks a menu item. virtual void ExecuteCommand(int id); private: // Our owner and HWND parent. - BlockedPopupContainerViewViews* container_; + BlockedPopupContainerViewWin* container_; // The button which brings up the popup menu. views::MenuButton* popup_count_label_; @@ -233,18 +108,15 @@ class BlockedPopupContainerInternalView : public views::View, // Our "X" button. views::ImageButton* close_button_; - // Model for the menu. - scoped_ptr<views::SimpleMenuModel> launch_menu_model_; - // Popup menu shown to user. - scoped_ptr<views::Menu2> launch_menu_; + scoped_ptr<views::Menu> launch_menu_; DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedPopupContainerInternalView); }; BlockedPopupContainerInternalView::BlockedPopupContainerInternalView( - BlockedPopupContainerViewViews* container) + BlockedPopupContainerViewWin* container) : container_(container) { ResourceBundle &resource_bundle = ResourceBundle::GetSharedInstance(); @@ -362,7 +234,8 @@ void BlockedPopupContainerInternalView::ButtonPressed( if (sender != popup_count_label_) return; - launch_menu_model_.reset(new views::SimpleMenuModel(this)); + launch_menu_.reset(views::Menu::Create(this, views::Menu::TOPLEFT, + container_->GetNativeView())); // Set items 1 .. popup_count as individual popups. size_t popup_count = container_->model()->GetBlockedPopupCount(); @@ -371,43 +244,45 @@ void BlockedPopupContainerInternalView::ButtonPressed( container_->GetURLAndTitleForPopup(i, &url, &title); // We can't just use the index into container_ here because Menu reserves // the value 0 as the nop command. - launch_menu_model_->AddItem(i + 1, - l10n_util::GetStringFUTF16(IDS_POPUP_TITLE_FORMAT, WideToUTF16(url), - WideToUTF16(title))); + launch_menu_->AppendMenuItem(i + 1, + l10n_util::GetStringF(IDS_POPUP_TITLE_FORMAT, url, title), + views::Menu::NORMAL); } // Set items (kImpossibleNumberOfPopups + 1) .. // (kImpossibleNumberOfPopups + hosts.size()) as hosts. std::vector<std::string> hosts(container_->model()->GetHosts()); if (!hosts.empty() && (popup_count > 0)) - launch_menu_model_->AddSeparator(); + launch_menu_->AppendSeparator(); size_t first_host = BlockedPopupContainer::kImpossibleNumberOfPopups + 1; for (size_t i = 0; i < hosts.size(); ++i) { - launch_menu_model_->AddCheckItem(first_host + i, - l10n_util::GetStringFUTF16(IDS_POPUP_HOST_FORMAT, - UTF8ToUTF16(hosts[i]))); + launch_menu_->AppendMenuItem(first_host + i, + l10n_util::GetStringF(IDS_POPUP_HOST_FORMAT, UTF8ToWide(hosts[i])), + views::Menu::NORMAL); } // Set items (kImpossibleNumberOfPopups + hosts.size() + 2) .. // (kImpossibleNumberOfPopups + hosts.size() + 1 + notice_count) as notices. size_t notice_count = container_->model()->GetBlockedNoticeCount(); if (notice_count && (!hosts.empty() || (popup_count > 0))) - launch_menu_model_->AddSeparator(); + launch_menu_->AppendSeparator(); size_t first_notice = first_host + hosts.size() + 1; for (size_t i = 0; i < notice_count; ++i) { std::string host; string16 reason; container_->model()->GetHostAndReasonForNotice(i, &host, &reason); - launch_menu_model_->AddItem(first_notice + i, - l10n_util::GetStringFUTF16(IDS_NOTICE_TITLE_FORMAT, ASCIIToUTF16(host), - reason)); + launch_menu_->AppendMenuItem(first_notice + i, + l10n_util::GetStringF(IDS_NOTICE_TITLE_FORMAT, ASCIIToWide(host), + reason), + views::Menu::NORMAL); } - launch_menu_.reset(new views::Menu2(launch_menu_model_.get())); - launch_menu_->RunContextMenuAt(views::Screen::GetCursorScreenPoint()); + CPoint cursor_position; + GetCursorPos(&cursor_position); + launch_menu_->RunMenuAt(cursor_position.x, cursor_position.y); } -bool BlockedPopupContainerInternalView::IsCommandIdChecked(int id) const { +bool BlockedPopupContainerInternalView::IsItemChecked(int id) const { // |id| should be > 0 since all index based commands have 1 added to them. DCHECK_GT(id, 0); size_t id_size_t = static_cast<size_t>(id); @@ -452,18 +327,18 @@ void BlockedPopupContainerInternalView::ExecuteCommand(int id) { // Nothing to do for now for notices. } -// BlockedPopupContainerViewViews --------------------------------------------- // static BlockedPopupContainerView* BlockedPopupContainerView::Create( BlockedPopupContainer* container) { - return new BlockedPopupContainerViewViews(container); + return new BlockedPopupContainerViewWin(container); } -BlockedPopupContainerViewViews::~BlockedPopupContainerViewViews() { + +BlockedPopupContainerViewWin::~BlockedPopupContainerViewWin() { } -void BlockedPopupContainerViewViews::GetURLAndTitleForPopup( +void BlockedPopupContainerViewWin::GetURLAndTitleForPopup( size_t index, std::wstring* url, std::wstring* title) const { DCHECK(url); DCHECK(title); @@ -475,24 +350,27 @@ void BlockedPopupContainerViewViews::GetURLAndTitleForPopup( // Overridden from AnimationDelegate: -void BlockedPopupContainerViewViews::AnimationStarted( +void BlockedPopupContainerViewWin::AnimationStarted( const Animation* animation) { SetPosition(); } -void BlockedPopupContainerViewViews::AnimationEnded(const Animation* animation) { +void BlockedPopupContainerViewWin::AnimationEnded(const Animation* animation) { SetPosition(); } -void BlockedPopupContainerViewViews::AnimationProgressed( +void BlockedPopupContainerViewWin::AnimationProgressed( const Animation* animation) { SetPosition(); } // Overridden from BlockedPopupContainerView: -void BlockedPopupContainerViewViews::SetPosition() { - gfx::Size parent_size = widget_->GetParentSize(); +void BlockedPopupContainerViewWin::SetPosition() { + // Get our parent's rect and size ourselves inside of it. + HWND parent = GetParent(); + CRect client_rect; + ::GetClientRect(parent, &client_rect); // TODO(erg): There's no way to detect whether scroll bars are // visible, so for beta, we're just going to assume that the @@ -500,12 +378,13 @@ void BlockedPopupContainerViewViews::SetPosition() { // the horizontal scroll bar. Fixing this is half of // http://b/1118139. gfx::Point anchor_point( - parent_size.width() - + client_rect.Width() - views::NativeScrollBar::GetVerticalScrollBarWidth(), - parent_size.height()); + client_rect.Height()); gfx::Size size = container_view_->GetPreferredSize(); int base_x = anchor_point.x() - size.width(); + int base_y = anchor_point.y() - size.height(); int real_height = static_cast<int>(size.height() * slide_animation_->GetCurrentValue()); @@ -523,51 +402,56 @@ void BlockedPopupContainerViewViews::SetPosition() { // is always a safe value for x-axis. x = 0; } - widget_->SetBoundsAndShow(gfx::Rect(x, real_y, size.width(), real_height)); + SetWindowPos(HWND_TOP, x, real_y, size.width(), real_height, + SWP_SHOWWINDOW); container_view_->SchedulePaint(); } else { - widget_->Hide(); + SetWindowPos(HWND_TOP, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); } } -void BlockedPopupContainerViewViews::ShowView() { - widget_->Show(); +void BlockedPopupContainerViewWin::ShowView() { + SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); slide_animation_->Show(); } -void BlockedPopupContainerViewViews::UpdateLabel() { +void BlockedPopupContainerViewWin::UpdateLabel() { container_view_->UpdateLabel(); } -void BlockedPopupContainerViewViews::HideView() { +void BlockedPopupContainerViewWin::HideView() { slide_animation_->Hide(); } -void BlockedPopupContainerViewViews::Destroy() { - widget_->Close(); +void BlockedPopupContainerViewWin::Destroy() { + Close(); } // private: -BlockedPopupContainerViewViews::BlockedPopupContainerViewViews( +BlockedPopupContainerViewWin::BlockedPopupContainerViewWin( BlockedPopupContainer* container) - : widget_(NULL), + : slide_animation_(new SlideAnimation(this)), model_(container), - container_view_(NULL), - slide_animation_(new SlideAnimation(this)) { - widget_ = new BlockedPopupContainerViewWidget(this, - model_->GetConstrainingContents(NULL)->GetNativeView()); + container_view_(NULL) { container_view_ = new BlockedPopupContainerInternalView(this); - widget_->SetContentsView(container_view_); + container_view_->SetVisible(true); + + set_window_style(WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); + WidgetWin::Init(model_->GetConstrainingContents(NULL)->GetNativeView(), + gfx::Rect()); + SetContentsView(container_view_); SetPosition(); } -void BlockedPopupContainerViewViews::UpdateWidgetShape( - BlockedPopupContainerViewWidget* widget, const gfx::Size& size) { - // Set the shape so we have rounded corners on the top. +void BlockedPopupContainerViewWin::OnSize(UINT param, const CSize& size) { + // Set the window region so we have rounded corners on the top. SkRect rect; - rect.set(0, 0, SkIntToScalar(size.width()), SkIntToScalar(size.height())); + rect.set(0, 0, SkIntToScalar(size.cx), SkIntToScalar(size.cy)); gfx::Path path; path.addRoundRect(rect, kRoundedCornerRad, SkPath::kCW_Direction); - widget->SetShape(path); + SetWindowRgn(path.CreateHRGN(), TRUE); + + ChangeSize(param, size); } diff --git a/chrome/browser/views/blocked_popup_container_view_views.h b/chrome/browser/views/blocked_popup_container_view_win.h index 2553021..b09763d 100644 --- a/chrome/browser/views/blocked_popup_container_view_views.h +++ b/chrome/browser/views/blocked_popup_container_view_win.h @@ -2,23 +2,42 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. -#ifndef CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_VIEW_VIEWS_H_ -#define CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_VIEW_VIEWS_H_ +#ifndef CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_VIEW_WIN_H_ +#define CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_VIEW_WIN_H_ -#include "app/animation.h" +#include <set> +#include <utility> +#include <vector> + +#include "app/gfx/native_widget_types.h" +#include "app/slide_animation.h" +#include "base/gfx/rect.h" #include "chrome/browser/blocked_popup_container.h" +#include "chrome/browser/tab_contents/tab_contents_delegate.h" +#include "views/controls/button/button.h" +#include "views/controls/button/menu_button.h" +#include "views/controls/menu/menu.h" +#include "views/view.h" +#include "views/widget/widget_win.h" -class BlockedPopupContainerViewWidget; class BlockedPopupContainerInternalView; -class SlideAnimation; +class PrefService; +class Profile; +class TabContents; +class TextButton; + +namespace views { +class ImageButton; +} // Takes ownership of TabContents that are unrequested popup windows and // presents an interface to the user for launching them. (Or never showing them // again). -class BlockedPopupContainerViewViews : public BlockedPopupContainerView, - public AnimationDelegate { +class BlockedPopupContainerViewWin : public BlockedPopupContainerView, + public AnimationDelegate, + public views::WidgetWin { public: - virtual ~BlockedPopupContainerViewViews(); + virtual ~BlockedPopupContainerViewWin(); // Returns the URL and title for popup |index|, used to construct a string for // display. @@ -44,17 +63,14 @@ class BlockedPopupContainerViewViews : public BlockedPopupContainerView, private: // For the static constructor BlockedPopupContainerView::Create(). friend class BlockedPopupContainerView; - friend class BlockedPopupContainerViewWidget; // Creates a container for a certain TabContents. - explicit BlockedPopupContainerViewViews(BlockedPopupContainer* container); + explicit BlockedPopupContainerViewWin(BlockedPopupContainer* container); - // Updates the shape of the widget. - void UpdateWidgetShape(BlockedPopupContainerViewWidget* widget, - const gfx::Size& size); + // Overridden from views::WidgetWin: - // Widget hosting container_view_. - BlockedPopupContainerViewWidget* widget_; + // Makes the top corners of the window rounded during resizing events. + virtual void OnSize(UINT param, const CSize& size); // Our model; calling the shots. BlockedPopupContainer* model_; @@ -65,7 +81,7 @@ class BlockedPopupContainerViewViews : public BlockedPopupContainerView, // The animation that slides us up and down. scoped_ptr<SlideAnimation> slide_animation_; - DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewViews); + DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewWin); }; -#endif // CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_VIEW_VIEWS_H_ +#endif // CHROME_BROWSER_VIEWS_BLOCKED_POPUP_CONTAINER_VIEW_WIN_H_ 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 7cb7bdb..ad274b3 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc @@ -13,6 +13,7 @@ #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" @@ -22,7 +23,6 @@ #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,11 +341,7 @@ gboolean TabContentsViewGtk::OnButtonPress(GtkWidget* widget, void TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { - gfx::Size new_size(allocation->width, allocation->height); - if (new_size == size_) - return; - - WasSized(new_size); + WasSized(gfx::Size(allocation->width, allocation->height)); } void TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) { @@ -370,7 +366,6 @@ 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()) @@ -379,3 +374,29 @@ 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 142c7b3..993992b 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h @@ -98,9 +98,6 @@ 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); }; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 8c3a234..3fa1905 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2085,8 +2085,8 @@ 'browser/views/autocomplete/autocomplete_popup_gtk.h', 'browser/views/blacklist_error_dialog.cc', 'browser/views/blacklist_error_dialog.h', - 'browser/views/blocked_popup_container_view_views.cc', - 'browser/views/blocked_popup_container_view_views.h', + 'browser/views/blocked_popup_container_view_win.cc', + 'browser/views/blocked_popup_container_view_win.h', 'browser/views/bookmark_bar_view.cc', 'browser/views/bookmark_bar_view.h', 'browser/views/bookmark_bubble_view.cc', @@ -2623,8 +2623,6 @@ ['include', '^browser/views/autocomplete/autocomplete_popup_contents_view.h'], ['include', '^browser/views/autocomplete/autocomplete_popup_gtk.cc'], ['include', '^browser/views/autocomplete/autocomplete_popup_gtk.h'], - ['include', '^browser/views/blocked_popup_container_view_views.cc'], - ['include', '^browser/views/blocked_popup_container_view_views.h'], ['include', '^browser/views/bookmark_bar_view.cc'], ['include', '^browser/views/bookmark_bar_view.h'], ['include', '^browser/views/bookmark_bubble_view.cc'], diff --git a/views/controls/menu/simple_menu_model.cc b/views/controls/menu/simple_menu_model.cc index 67a9e2d..de86bce 100644 --- a/views/controls/menu/simple_menu_model.cc +++ b/views/controls/menu/simple_menu_model.cc @@ -103,9 +103,7 @@ bool SimpleMenuModel::GetAcceleratorAt(int index, bool SimpleMenuModel::IsItemCheckedAt(int index) const { if (!delegate_) return false; - int item_index = FlipIndex(index); - return (items_[item_index].type == TYPE_CHECK) ? - delegate_->IsCommandIdChecked(GetCommandIdAt(index)) : false; + return delegate_->IsCommandIdChecked(GetCommandIdAt(index)); } int SimpleMenuModel::GetGroupIdAt(int index) const { diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 51140a6..cc0aec9 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -628,15 +628,6 @@ void WidgetGtk::CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds) { } void WidgetGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { - // See comment next to size_ as to why we do this. Also note, it's tempting - // to put this in the static method so subclasses don't need to worry about - // it, but if a subclasses needs to set a shape then they need to always - // reset the shape in this method regardless of whether the size changed. - gfx::Size new_size(allocation->width, allocation->height); - if (new_size == size_) - return; - - size_ = new_size; root_view_->SetBounds(0, 0, allocation->width, allocation->height); root_view_->SchedulePaint(); } diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index e082eea..ccd3bd5 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -8,7 +8,6 @@ #include <gtk/gtk.h> #include "app/active_window_watcher_x.h" -#include "base/gfx/size.h" #include "base/message_loop.h" #include "views/focus/focus_manager.h" #include "views/widget/widget.h" @@ -414,12 +413,6 @@ class WidgetGtk // See make_transient_to_parent for a description. bool transient_to_parent_; - // Last size supplied to OnSizeAllocate. We cache this as any time the - // size of a GtkWidget changes size_allocate is called, even if the size - // didn't change. If we didn't cache this and ignore calls when the size - // hasn't changed, we can end up getting stuck in a never ending loop. - gfx::Size size_; - DISALLOW_COPY_AND_ASSIGN(WidgetGtk); }; |