diff options
-rw-r--r-- | app/gfx/canvas_linux.cc | 30 | ||||
-rw-r--r-- | app/gfx/font.h | 5 | ||||
-rw-r--r-- | app/gfx/font_skia.cc | 43 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/chromeos/chromeos_version_loader.h | 2 | ||||
-rwxr-xr-x | chrome/browser/gtk/browser_window_gtk.cc | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/views/about_chrome_view.cc | 48 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/views/about_chrome_view.h | 18 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/views/browser_dialogs.h | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/views/dialog_stubs_gtk.cc | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | chrome/browser/views/frame/browser_view.cc | 3 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 4 | ||||
-rw-r--r-- | views/controls/label.cc | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | views/window/dialog_client_view.cc | 8 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 5 | ||||
-rw-r--r-- | views/window/window_gtk.h | 2 |
15 files changed, 133 insertions, 57 deletions
diff --git a/app/gfx/canvas_linux.cc b/app/gfx/canvas_linux.cc index 7ed1904..fc4e10e3 100644 --- a/app/gfx/canvas_linux.cc +++ b/app/gfx/canvas_linux.cc @@ -98,8 +98,10 @@ Canvas::Canvas() : skia::PlatformCanvas() { Canvas::~Canvas() { } +// Pass a width > 0 to force wrapping and elliding. static void SetupPangoLayout(PangoLayout* layout, const gfx::Font& font, + int width, int flags) { if (!cairo_font_options) UpdateCairoFontOptions(); @@ -112,6 +114,9 @@ static void SetupPangoLayout(PangoLayout* layout, // scope out RTL characters. pango_layout_set_auto_dir(layout, FALSE); + if (width > 0) + pango_layout_set_width(layout, width * PANGO_SCALE); + if (flags & Canvas::NO_ELLIPSIS) { pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); } else { @@ -144,14 +149,16 @@ void Canvas::SizeStringInt(const std::wstring& text, cairo_t* cr = cairo_create(surface); PangoLayout* layout = pango_cairo_create_layout(cr); - SetupPangoLayout(layout, font, flags); + SetupPangoLayout(layout, font, *width, flags); std::string utf8 = WideToUTF8(text); pango_layout_set_text(layout, utf8.data(), utf8.size()); - pango_layout_get_size(layout, width, height); + int chars_height; + pango_layout_get_size(layout, width, &chars_height); *width /= PANGO_SCALE; - *height /= PANGO_SCALE; + // Pango returns the height of the characters, not the height of the font. + *height = font.height(); g_object_unref(layout); cairo_destroy(cr); @@ -160,14 +167,14 @@ void Canvas::SizeStringInt(const std::wstring& text, void Canvas::DrawStringInt(const std::wstring& text, const gfx::Font& font, - const SkColor& color, int x, int y, int w, int h, + const SkColor& color, + int x, int y, int w, int h, int flags) { cairo_t* cr = beginPlatformPaint(); PangoLayout* layout = pango_cairo_create_layout(cr); - SetupPangoLayout(layout, font, flags); + SetupPangoLayout(layout, font, w, flags); - pango_layout_set_width(layout, w * PANGO_SCALE); pango_layout_set_height(layout, h * PANGO_SCALE); cairo_save(cr); @@ -179,16 +186,19 @@ void Canvas::DrawStringInt(const std::wstring& text, std::string utf8 = WideToUTF8(text); pango_layout_set_text(layout, utf8.data(), utf8.size()); - int width, height; - pango_layout_get_size(layout, &width, &height); + int width, height, chars_height; + pango_layout_get_size(layout, &width, &chars_height); + width /= PANGO_SCALE; + // Pango returns the height of the characters, not the height of the font. + height = font.height(); if (flags & Canvas::TEXT_VALIGN_TOP) { // Cairo should draw from the top left corner already. } else if (flags & Canvas::TEXT_VALIGN_BOTTOM) { - y = y + (h - (height / PANGO_SCALE)); + y += (h - height); } else { // Vertically centered. - y = y + ((h - (height / PANGO_SCALE)) / 2); + y += ((h - height) / 2); } cairo_rectangle(cr, x, y, w, h); diff --git a/app/gfx/font.h b/app/gfx/font.h index e53bd79..bc8ee92 100644 --- a/app/gfx/font.h +++ b/app/gfx/font.h @@ -206,6 +206,9 @@ class Font { // The default font, used for the default constructor. static Font* default_font_; + // The average width of a character, initialized and cached if needed. + double avg_width(); + // These two both point to the same SkTypeface. We use the SkAutoUnref to // handle the reference counting, but without @typeface_ we would have to // cast the SkRefCnt from @typeface_helper_ every time. @@ -221,7 +224,7 @@ class Font { // Cached metrics, generated at construction int height_; int ascent_; - int avg_width_; + double avg_width_; #elif defined(OS_MACOSX) explicit Font(const std::wstring& font_name, int font_size, int style); diff --git a/app/gfx/font_skia.cc b/app/gfx/font_skia.cc index 41c29c6..70d6cf2 100644 --- a/app/gfx/font_skia.cc +++ b/app/gfx/font_skia.cc @@ -69,22 +69,14 @@ Font::Font(SkTypeface* tf, const std::wstring& font_family, int font_size, void Font::calculateMetrics() { SkPaint paint; SkPaint::FontMetrics metrics; - PaintSetup(&paint); paint.getFontMetrics(&metrics); ascent_ = SkScalarCeil(-metrics.fAscent); height_ = ascent_ + SkScalarCeil(metrics.fDescent); + // avg_width_ is calculated lazily, as it's expensive and not used often. + avg_width_ = -1.0; - if (metrics.fAvgCharWidth) { - avg_width_ = SkScalarRound(metrics.fAvgCharWidth); - } else { - static const char x_char = 'x'; - paint.setTextEncoding(SkPaint::kUTF8_TextEncoding); - SkScalar width = paint.measureText(&x_char, 1); - - avg_width_ = static_cast<int>(ceilf(SkScalarToFloat(width))); - } } void Font::CopyFont(const Font& other) { @@ -108,7 +100,7 @@ int Font::baseline() const { } int Font::ave_char_width() const { - return avg_width_; + return SkScalarRound(const_cast<Font*>(this)->avg_width()); } Font Font::CreateFont(const std::wstring& font_family, int font_size) { @@ -176,10 +168,35 @@ int Font::GetStringWidth(const std::wstring& text) const { return width; } -int Font::GetExpectedTextWidth(int length) const { - return length * avg_width_; +double Font::avg_width() { + if (avg_width_ < 0) { + // First get the pango based width + PangoFontDescription* pango_desc = gfx::Font::PangoFontFromGfxFont(*this); + PangoContext* context = + gdk_pango_context_get_for_screen(gdk_screen_get_default()); + PangoFontMetrics* pango_metrics = + pango_context_get_metrics(context, + pango_desc, + pango_language_get_default()); + double pango_width = + pango_font_metrics_get_approximate_char_width(pango_metrics); + pango_width /= PANGO_SCALE; + + // Yes, this is how Microsoft recommends calculating the dialog unit + // conversions. + int text_width = GetStringWidth( + L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); + double dialog_units = (text_width / 26 + 1) / 2; + + avg_width_ = std::min(pango_width, dialog_units); + } + return avg_width_; } +int Font::GetExpectedTextWidth(int length) const { + double char_width = const_cast<Font*>(this)->avg_width(); + return round(static_cast<float>(length) * char_width); +} int Font::style() const { return style_; diff --git a/chrome/browser/chromeos/chromeos_version_loader.h b/chrome/browser/chromeos/chromeos_version_loader.h index 85047b0..1dccd31 100644..100755 --- a/chrome/browser/chromeos/chromeos_version_loader.h +++ b/chrome/browser/chromeos/chromeos_version_loader.h @@ -40,7 +40,7 @@ class ChromeOSVersionLoader : public CancelableRequestProvider { // ChromeOSVersionLoader calls into the Backend on the file thread to load // and extract the version. - class Backend : public base::RefCounted<Backend> { + class Backend : public base::RefCountedThreadSafe<Backend> { public: Backend() {} diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 8bb1540..60834d6 100755 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -81,6 +81,7 @@ #include "chrome/browser/chromeos/compact_navigation_bar.h" #include "chrome/browser/chromeos/main_menu.h" #include "chrome/browser/chromeos/status_area_view.h" +#include "chrome/browser/views/browser_dialogs.h" #include "chrome/browser/views/panel_controller.h" #include "chrome/browser/views/tabs/tab_overview_types.h" #include "views/widget/widget_gtk.h" @@ -1059,7 +1060,11 @@ void BrowserWindowGtk::ToggleExtensionShelf() { } void BrowserWindowGtk::ShowAboutChromeDialog() { +#if defined(OS_CHROMEOS) + browser::ShowAboutChromeView(window_, browser_->profile()); +#else ShowAboutDialogForProfile(window_, browser_->profile()); +#endif } void BrowserWindowGtk::ShowTaskManager() { diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 6c2dad1..63fabce 100644..100755 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -4,8 +4,6 @@ #include "chrome/browser/views/about_chrome_view.h" -#include <commdlg.h> - #include "app/gfx/canvas.h" #include "app/gfx/color_utils.h" #include "base/i18n/word_iterator.h" @@ -13,13 +11,10 @@ #include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/string_util.h" -#include "base/win_util.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/metrics/user_metrics.h" -#include "chrome/browser/views/restart_message_box.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/url_constants.h" -#include "chrome/installer/util/install_util.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -31,6 +26,14 @@ #include "views/window/window.h" #include "webkit/glue/webkit_glue.h" +#if defined(OS_WIN) +#include <commdlg.h> + +#include "base/win_util.h" +#include "chrome/browser/views/restart_message_box.h" +#include "chrome/installer/util/install_util.h" +#endif + namespace { // The pixel width of the version text field. Ideally, we'd like to have the // bounds set to the edge of the icon. However, the icon is not a view but a @@ -63,9 +66,10 @@ std::wstring StringSubRange(const std::wstring& text, size_t start, namespace browser { // Declared in browser_dialogs.h so that others don't need to depend on our .h. -void ShowAboutChromeView(views::Widget* parent, +void ShowAboutChromeView(gfx::NativeWindow parent, Profile* profile) { - views::Window::CreateChromeWindow(parent->GetNativeView(), gfx::Rect(), + views::Window::CreateChromeWindow(parent, + gfx::Rect(), new AboutChromeView(profile))->Show(); } @@ -82,17 +86,19 @@ AboutChromeView::AboutChromeView(Profile* profile) copyright_label_(NULL), main_text_label_(NULL), main_text_label_height_(0), - terms_of_service_url_(NULL), chromium_url_(NULL), open_source_url_(NULL), - chromium_url_appears_first_(true), + terms_of_service_url_(NULL), check_button_status_(CHECKBUTTON_HIDDEN), + chromium_url_appears_first_(true), text_direction_is_rtl_(false) { DCHECK(profile); Init(); +#if defined(OS_WIN) google_updater_ = new GoogleUpdate(); google_updater_->AddStatusChangeListener(this); +#endif if (kBackgroundBmp == NULL) { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -101,10 +107,12 @@ AboutChromeView::AboutChromeView(Profile* profile) } AboutChromeView::~AboutChromeView() { +#if defined(OS_WIN) // The Google Updater will hold a pointer to us until it reports status, so we // need to let it know that we will no longer be listening. if (google_updater_) google_updater_->RemoveStatusChangeListener(); +#endif } void AboutChromeView::Init() { @@ -165,19 +173,19 @@ void AboutChromeView::Init() { about_title_label_ = new views::Label( l10n_util::GetString(IDS_PRODUCT_NAME)); about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( - ResourceBundle::BaseFont).DeriveFont(18, BOLD_FONTTYPE)); + ResourceBundle::BaseFont).DeriveFont(18, gfx::Font::BOLD)); about_title_label_->SetColor(SK_ColorBLACK); AddChildView(about_title_label_); // This is a text field so people can copy the version number from the dialog. version_label_ = new views::Textfield(); - version_label_->SetText(current_version_); + version_label_->SetText(WideToUTF16Hack(current_version_)); version_label_->SetReadOnly(true); version_label_->RemoveBorder(); version_label_->SetTextColor(SK_ColorBLACK); version_label_->SetBackgroundColor(SK_ColorWHITE); version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( - ResourceBundle::BaseFont).DeriveFont(0, BOLD_FONTTYPE)); + ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD)); AddChildView(version_label_); // The copyright URL portion of the main label. @@ -476,9 +484,10 @@ void AboutChromeView::DrawTextAndPositionUrl(gfx::Canvas* canvas, // figure out here where to place it. if (link && rect) { gfx::Size sz = link->GetPreferredSize(); + gfx::Insets insets = link->GetInsets(); WrapIfWordDoesntFit(sz.width(), font.height(), position, bounds); - *rect = gfx::Rect(position->width(), position->height(), sz.width(), - sz.height()); + *rect = gfx::Rect(position->width(), position->height() - insets.top(), + sz.width(), sz.height()); // Go from relative pixel coordinates (within the label we are drawing on) // to absolute pixel coordinates (relative to the top left corner of the @@ -499,7 +508,7 @@ void AboutChromeView::DrawTextStartingFrom(gfx::Canvas* canvas, const SkColor text_color = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); #else // TODO(beng): source from theme provider. - const SkColor text_color = SkColor_BLACK; + const SkColor text_color = SK_ColorBLACK; #endif // Iterate through line breaking opportunities (which in English would be @@ -591,6 +600,7 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add, parent->AddChildView(&timeout_indicator_); timeout_indicator_.SetVisible(false); +#if defined (OS_WIN) // On-demand updates for Chrome don't work in Vista RTM when UAC is turned // off. So, in this case we just want the About box to not mention // on-demand updates. Silent updates (in the background) should still @@ -607,6 +617,7 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add, // CheckForUpdate(false, ...) means don't upgrade yet. google_updater_->CheckForUpdate(false, window()); } +#endif } else { parent->RemoveChildView(&update_label_); parent->RemoveChildView(throbber_.get()); @@ -680,6 +691,7 @@ std::wstring AboutChromeView::GetWindowTitle() const { } bool AboutChromeView::Accept() { +#if defined(OS_WIN) UpdateStatus(UPGRADE_STARTED, GOOGLE_UPDATE_NO_ERROR); // The Upgrade button isn't available until we have received notification @@ -690,6 +702,7 @@ bool AboutChromeView::Accept() { google_updater_->AddStatusChangeListener(this); // CheckForUpdate(true,...) means perform the upgrade if new version found. google_updater_->CheckForUpdate(true, window()); +#endif return false; // We never allow this button to close the window. } @@ -707,7 +720,7 @@ void AboutChromeView::LinkActivated(views::Link* source, if (source == terms_of_service_url_) url = GURL(chrome::kAboutTermsURL); else if (source == chromium_url_) - url = GURL(l10n_util::GetString(IDS_CHROMIUM_PROJECT_URL)); + url = GURL(WideToUTF16Hack(l10n_util::GetString(IDS_CHROMIUM_PROJECT_URL))); else if (source == open_source_url_) url = GURL(chrome::kAboutCreditsURL); else @@ -717,6 +730,7 @@ void AboutChromeView::LinkActivated(views::Link* source, browser->OpenURL(url, GURL(), NEW_WINDOW, PageTransition::LINK); } +#if defined(OS_WIN) //////////////////////////////////////////////////////////////////////////////// // AboutChromeView, GoogleUpdateStatusListener implementation: @@ -843,3 +857,5 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, if (window()) GetDialogClientView()->UpdateDialogButtons(); } + +#endif diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h index 8935cf9..cfb8a03 100644..100755 --- a/chrome/browser/views/about_chrome_view.h +++ b/chrome/browser/views/about_chrome_view.h @@ -5,13 +5,16 @@ #ifndef CHROME_BROWSER_VIEWS_ABOUT_CHROME_VIEW_H_ #define CHROME_BROWSER_VIEWS_ABOUT_CHROME_VIEW_H_ -#include "chrome/browser/google_update.h" #include "views/controls/image_view.h" #include "views/controls/label.h" #include "views/controls/link.h" #include "views/view.h" #include "views/window/dialog_delegate.h" +#if defined(OS_WIN) +#include "chrome/browser/google_update.h" +#endif + namespace views { class Textfield; class Throbber; @@ -29,8 +32,11 @@ class Profile; //////////////////////////////////////////////////////////////////////////////// class AboutChromeView : public views::View, public views::DialogDelegate, - public views::LinkController, - public GoogleUpdateStatusListener { + public views::LinkController +#if defined (OS_WIN) + , public GoogleUpdateStatusListener +#endif + { public: explicit AboutChromeView(Profile* profile); virtual ~AboutChromeView(); @@ -65,10 +71,12 @@ class AboutChromeView : public views::View, // Overridden from views::LinkController: virtual void LinkActivated(views::Link* source, int event_flags); +#if defined(OS_WIN) // Overridden from GoogleUpdateStatusListener: virtual void OnReportResults(GoogleUpdateUpgradeResult result, GoogleUpdateErrorCode error_code, const std::wstring& version); +#endif private: // The visible state of the Check For Updates button. @@ -78,9 +86,11 @@ class AboutChromeView : public views::View, CHECKBUTTON_ENABLED, }; +#if defined(OS_WIN) // Update the UI to show the status of the upgrade. void UpdateStatus(GoogleUpdateUpgradeResult result, GoogleUpdateErrorCode error_code); +#endif // Draws a string onto the canvas (wrapping if needed) while also keeping // track of where it ends so we can position a URL after the text. The @@ -160,9 +170,11 @@ class AboutChromeView : public views::View, // Determines the order of the two links we draw in the main label. bool chromium_url_appears_first_; +#if defined(OS_WIN) // The class that communicates with Google Update to find out if an update is // available and asks it to start an upgrade. scoped_refptr<GoogleUpdate> google_updater_; +#endif // Our current version. std::wstring current_version_; diff --git a/chrome/browser/views/browser_dialogs.h b/chrome/browser/views/browser_dialogs.h index d4c2420..691eee6 100644..100755 --- a/chrome/browser/views/browser_dialogs.h +++ b/chrome/browser/views/browser_dialogs.h @@ -64,7 +64,7 @@ bool IsBookmarkBubbleViewShowing(); void ShowBookmarkManagerView(Profile* profile); // Shows the about dialog. See AboutChromeView. -void ShowAboutChromeView(views::Widget* parent, +void ShowAboutChromeView(gfx::NativeWindow parent, Profile* profile); // Shows an HTML dialog. See HtmlDialogView. diff --git a/chrome/browser/views/dialog_stubs_gtk.cc b/chrome/browser/views/dialog_stubs_gtk.cc index c3a4e13..53bfc58 100644..100755 --- a/chrome/browser/views/dialog_stubs_gtk.cc +++ b/chrome/browser/views/dialog_stubs_gtk.cc @@ -51,10 +51,11 @@ void ShowBookmarkManagerView(Profile* profile) { BookmarkManagerGtk::Show(profile); } -void ShowAboutChromeView(views::Widget* parent, - Profile* profile) { - ShowAboutDialogForProfile(GTK_WINDOW(parent->GetNativeView()), profile); +#if not defined(OS_CHROMEOS) +void ShowAboutChromeView(gfx::NativeWindow parent, Profile* profile) { + ShowAboutDialogForProfile(parent, profile); } +#endif void ShowHtmlDialogView(gfx::NativeWindow parent, Browser* browser, HtmlDialogUIDelegate* delegate) { diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index f75af67..e721862 100644..100755 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1003,7 +1003,8 @@ void BrowserView::ToggleExtensionShelf() { } void BrowserView::ShowAboutChromeDialog() { - browser::ShowAboutChromeView(GetWidget(), browser_->profile()); + browser::ShowAboutChromeView(GetWindow()->GetNativeWindow(), + browser_->profile()); } void BrowserView::ShowTaskManager() { diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 9b34464..2ec85fc 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2894,6 +2894,10 @@ '<(INTERMEDIATE_DIR)/chrome', ], 'sources/': [ + ['include', 'browser/views/about_chrome_view.cc'], + ['include', 'browser/views/about_chrome_view.h'], + ['exclude', 'browser/gtk/about_chrome_dialog.cc'], + ['exclude', 'browser/gtk/about_chrome_dialog.h'], ['include', 'browser/views/new_browser_window_widget.cc'], ['include', 'browser/views/new_browser_window_widget.h'], ['include', 'browser/views/options/options_page_view.cc'], diff --git a/views/controls/label.cc b/views/controls/label.cc index 6e9a360..6da6c48 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -100,6 +100,14 @@ gfx::Size Label::GetPreferredSize() { int Label::ComputeMultiLineFlags() { int flags = gfx::Canvas::MULTI_LINE; + #if !defined(OS_WIN) + // Don't ellide multiline labels on Linux. + // Todo(davemoore): Do we depend on elliding multiline text? + // Pango insists on limiting the number of lines to one if text is + // ellided. You can get around this if you can pass a maximum height + // but we don't currently have that data when we call the pango code. + flags |= gfx::Canvas::NO_ELLIPSIS; + #endif if (allow_character_break_) flags |= gfx::Canvas::CHARACTER_BREAK; switch (horiz_alignment_) { diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 40355d4..64c4677 100644..100755 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -251,14 +251,10 @@ bool DialogClientView::CanClose() const { } void DialogClientView::WindowClosing() { -#if defined(OS_WIN) FocusManager* focus_manager = GetFocusManager(); DCHECK(focus_manager); if (focus_manager) focus_manager->RemoveFocusChangeListener(this); -#else - NOTIMPLEMENTED(); -#endif ClientView::WindowClosing(); } @@ -306,16 +302,12 @@ void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent, ShowDialogButtons(); ClientView::ViewHierarchyChanged(is_add, parent, child); -#if defined(OS_WIN) FocusManager* focus_manager = GetFocusManager(); // Listen for focus change events so we can update the default button. DCHECK(focus_manager); // bug #1291225: crash reports seem to indicate it // can be NULL. if (focus_manager) focus_manager->AddFocusChangeListener(this); -#else - NOTIMPLEMENTED(); -#endif // The "extra view" must be created and installed after the contents view // has been inserted into the view hierarchy. diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index a3a3192..c17df87 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -451,4 +451,9 @@ void WindowGtk::SizeWindowToDefault(GtkWindow* parent) { SetBounds(bounds, NULL); } +void WindowGtk::OnDestroy() { + non_client_view_->WindowClosing(); + WidgetGtk::OnDestroy(); +} + } // namespace views diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index f7fffc7..7829e28 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -78,6 +78,8 @@ class WindowGtk : public WidgetGtk, public Window { // Initializes the window to the passed in bounds. void Init(GtkWindow* parent, const gfx::Rect& bounds); + virtual void OnDestroy(); + private: static gboolean CallConfigureEvent(GtkWidget* widget, GdkEventConfigure* event, |