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

Side by Side Diff: chrome/browser/ui/gtk/apps/native_app_window_gtk.cc

Issue 22903022: Limit constrained windows to the size of the parent view. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed comments Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h" 5 #include "chrome/browser/ui/gtk/apps/native_app_window_gtk.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop/message_pump_gtk.h" 10 #include "base/message_loop/message_pump_gtk.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 374 }
375 375
376 gfx::Point NativeAppWindowGtk::GetDialogPosition(const gfx::Size& size) { 376 gfx::Point NativeAppWindowGtk::GetDialogPosition(const gfx::Size& size) {
377 gint current_width = 0; 377 gint current_width = 0;
378 gint current_height = 0; 378 gint current_height = 0;
379 gtk_window_get_size(window_, &current_width, &current_height); 379 gtk_window_get_size(window_, &current_width, &current_height);
380 return gfx::Point(current_width / 2 - size.width() / 2, 380 return gfx::Point(current_width / 2 - size.width() / 2,
381 current_height / 2 - size.height() / 2); 381 current_height / 2 - size.height() / 2);
382 } 382 }
383 383
384 gfx::Size NativeAppWindowGtk::GetMaximumDialogSize() {
385 gint current_width = 0;
386 gint current_height = 0;
387 gtk_window_get_size(window_, &current_width, &current_height);
388 return gfx::Size(current_width, current_height);
389 }
390
384 void NativeAppWindowGtk::AddObserver( 391 void NativeAppWindowGtk::AddObserver(
385 web_modal::WebContentsModalDialogHostObserver* observer) { 392 web_modal::WebContentsModalDialogHostObserver* observer) {
386 observer_list_.AddObserver(observer); 393 observer_list_.AddObserver(observer);
387 } 394 }
388 395
389 void NativeAppWindowGtk::RemoveObserver( 396 void NativeAppWindowGtk::RemoveObserver(
390 web_modal::WebContentsModalDialogHostObserver* observer) { 397 web_modal::WebContentsModalDialogHostObserver* observer) {
391 observer_list_.RemoveObserver(observer); 398 observer_list_.RemoveObserver(observer);
392 } 399 }
393 400
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 624 }
618 625
619 void NativeAppWindowGtk::UpdateDraggableRegions( 626 void NativeAppWindowGtk::UpdateDraggableRegions(
620 const std::vector<extensions::DraggableRegion>& regions) { 627 const std::vector<extensions::DraggableRegion>& regions) {
621 // Draggable region is not supported for non-frameless window. 628 // Draggable region is not supported for non-frameless window.
622 if (!frameless_) 629 if (!frameless_)
623 return; 630 return;
624 631
625 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions)); 632 draggable_region_.reset(ShellWindow::RawDraggableRegionsToSkRegion(regions));
626 } 633 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698