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

Unified Diff: chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc

Issue 13588007: Implement WebContentsModalDialogManagerDelegate for ShellWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OVERRIDEs Created 7 years, 9 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/extensions/native_app_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc b/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc
index 045a8e0f47cb3e2a8e50d4f4150c9104d6e11f85..0aa671f3dad21701bf2f61d625467b42588e5bc2 100644
--- a/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc
@@ -287,6 +287,24 @@ gfx::Insets NativeAppWindowGtk::GetFrameInsets() const {
rect_with_decorations.width - current_width - left_inset);
}
+gfx::Point NativeAppWindowGtk::GetDialogPosition(const gfx::Size& size) {
+ gint current_width = 0;
+ gint current_height = 0;
+ gtk_window_get_size(window_, &current_width, &current_height);
+ return gfx::Point(current_width / 2 - size.width() / 2,
+ current_height / 2 - size.height() / 2);
+}
+
+void NativeAppWindowGtk::AddObserver(
+ WebContentsModalDialogHostObserver* observer) {
+ observer_list_.AddObserver(observer);
+}
+
+void NativeAppWindowGtk::RemoveObserver(
+ WebContentsModalDialogHostObserver* observer) {
+ observer_list_.RemoveObserver(observer);
+}
+
void NativeAppWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
// Do nothing if we're in the process of closing the browser window.
if (!window_)
@@ -336,6 +354,10 @@ gboolean NativeAppWindowGtk::OnConfigure(GtkWidget* widget,
void NativeAppWindowGtk::OnDebouncedBoundsChanged() {
gtk_window_util::UpdateWindowPosition(this, &bounds_, &restored_bounds_);
shell_window_->OnNativeWindowChanged();
+
+ FOR_EACH_OBSERVER(WebContentsModalDialogHostObserver,
+ observer_list_,
+ OnPositionRequiresUpdate());
jeremya 2013/04/04 19:59:17 This code could live in OnNativeWindowChanged(), I
Mike Wittman 2013/04/04 22:56:08 See comment in the .h file. Also, OnNativeWindowC
}
gboolean NativeAppWindowGtk::OnWindowState(GtkWidget* sender,

Powered by Google App Engine
This is Rietveld 408576698