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

Unified Diff: chrome/browser/ui/views/extensions/shell_window_views.cc

Issue 11369237: Add a way to fetch window frame metrics from NativeShellWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change ShellWindowViews frame insets logic Created 8 years, 1 month 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/views/extensions/shell_window_views.cc
diff --git a/chrome/browser/ui/views/extensions/shell_window_views.cc b/chrome/browser/ui/views/extensions/shell_window_views.cc
index 677359bffd5f0c4f9b48729e6ada8f56afd6d062..a17333891977728f93d2cdffa31d756e825bda71 100644
--- a/chrome/browser/ui/views/extensions/shell_window_views.cc
+++ b/chrome/browser/ui/views/extensions/shell_window_views.cc
@@ -409,9 +409,8 @@ ShellWindowViews::ShellWindowViews(ShellWindow* shell_window,
minimum_size_ = win_params.minimum_size;
maximum_size_ = win_params.maximum_size;
window_->Init(params);
- gfx::Rect window_bounds =
- window_->non_client_view()->GetWindowBoundsForClientBounds(
- win_params.bounds);
+ gfx::Rect window_bounds = win_params.bounds;
+ window_bounds.Inset(-GetFrameInsets());
// Center window if no position was specified.
if (win_params.bounds.x() == INT_MIN || win_params.bounds.y() == INT_MIN) {
window_->CenterWindow(window_bounds.size());
@@ -574,6 +573,17 @@ bool ShellWindowViews::IsAlwaysOnTop() const {
return false;
}
+gfx::Insets ShellWindowViews::GetFrameInsets() const {
+ if (frameless())
+ return gfx::Insets();
+
+ gfx::Rect client_bounds = gfx::Rect(100, 100);
stevenjb 2012/11/27 01:12:47 I take it 100 x 100 is arbitrary? I assume it just
jeremya 2012/11/27 02:50:16 it just needs to be large enough that GetWindowBou
+ gfx::Rect window_bounds =
+ window_->non_client_view()->GetWindowBoundsForClientBounds(
+ client_bounds);
+ return window_bounds.InsetsFrom(client_bounds);
+}
+
void ShellWindowViews::DeleteDelegate() {
shell_window_->OnNativeClose();
}
« no previous file with comments | « chrome/browser/ui/views/extensions/shell_window_views.h ('k') | chrome/browser/ui/views/select_file_dialog_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698