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

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: add comments 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 098849b03a5dc2f6c43cea45cc1d150415cd83a2..256159a85769357749502a63fc65077804cb0567 100644
--- a/chrome/browser/ui/views/extensions/shell_window_views.cc
+++ b/chrome/browser/ui/views/extensions/shell_window_views.cc
@@ -409,9 +409,7 @@ 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 = WindowBoundsForContentBounds(win_params.bounds);
// 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 +572,28 @@ bool ShellWindowViews::IsAlwaysOnTop() const {
return false;
}
+gfx::Rect ShellWindowViews::ContentBoundsForWindowBounds(
+ const gfx::Rect& window_bounds) const {
+ if (frameless()) {
+ return window_bounds;
+ } else {
+ gfx::Rect bounds = window_bounds;
+ bounds.set_height(std::max(0, bounds.height() - kCaptionHeight));
+ return bounds;
+ }
+}
+
+gfx::Rect ShellWindowViews::WindowBoundsForContentBounds(
+ const gfx::Rect& content_bounds) const {
+ if (frameless()) {
+ return content_bounds;
+ } else {
+ gfx::Rect bounds = content_bounds;
+ bounds.set_height(bounds.height() + kCaptionHeight);
+ return bounds;
+ }
+}
+
void ShellWindowViews::DeleteDelegate() {
shell_window_->OnNativeClose();
}

Powered by Google App Engine
This is Rietveld 408576698