| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/frame/opaque_non_client_view.h" | 5 #include "chrome/browser/views/frame/opaque_non_client_view.h" |
| 6 | 6 |
| 7 #include "chrome/app/theme/theme_resources.h" | 7 #include "chrome/app/theme/theme_resources.h" |
| 8 #include "chrome/browser/views/frame/browser_view2.h" | 8 #include "chrome/browser/views/frame/browser_view2.h" |
| 9 #include "chrome/browser/views/tabs/tab_strip.h" | 9 #include "chrome/browser/views/tabs/tab_strip.h" |
| 10 #include "chrome/browser/views/window_resources.h" | 10 #include "chrome/browser/views/window_resources.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 int top_height = CalculateNonClientTopHeight(); | 451 int top_height = CalculateNonClientTopHeight(); |
| 452 int window_x = std::max(0, client_bounds.x() - kWindowHorizontalBorderSize); | 452 int window_x = std::max(0, client_bounds.x() - kWindowHorizontalBorderSize); |
| 453 int window_y = std::max(0, client_bounds.y() - top_height); | 453 int window_y = std::max(0, client_bounds.y() - top_height); |
| 454 int window_w = client_bounds.width() + (2 * kWindowHorizontalBorderSize); | 454 int window_w = client_bounds.width() + (2 * kWindowHorizontalBorderSize); |
| 455 int window_h = | 455 int window_h = |
| 456 client_bounds.height() + top_height + kWindowVerticalBorderBottomSize; | 456 client_bounds.height() + top_height + kWindowVerticalBorderBottomSize; |
| 457 return gfx::Rect(window_x, window_y, window_w, window_h); | 457 return gfx::Rect(window_x, window_y, window_w, window_h); |
| 458 } | 458 } |
| 459 | 459 |
| 460 gfx::Rect OpaqueNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { | 460 gfx::Rect OpaqueNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { |
| 461 int tabstrip_height = tabstrip->GetPreferredHeight(); | |
| 462 int tabstrip_x = otr_avatar_bounds_.right(); | 461 int tabstrip_x = otr_avatar_bounds_.right(); |
| 462 int tabstrip_y = CalculateNonClientTopHeight(); |
| 463 int tabstrip_height = |
| 464 browser_view_->IsTabStripVisible() ? tabstrip->GetPreferredHeight() : 0; |
| 463 int tabstrip_width = minimize_button_->x() - tabstrip_x; | 465 int tabstrip_width = minimize_button_->x() - tabstrip_x; |
| 464 if (frame_->IsMaximized()) | 466 if (frame_->IsMaximized()) |
| 465 tabstrip_width -= kNewTabIconWindowControlsSpacing; | 467 tabstrip_width -= kNewTabIconWindowControlsSpacing; |
| 466 return gfx::Rect(tabstrip_x, 0, tabstrip_width, tabstrip_height); | 468 return gfx::Rect(tabstrip_x, tabstrip_y, tabstrip_width, tabstrip_height); |
| 467 } | 469 } |
| 468 | 470 |
| 469 void OpaqueNonClientView::UpdateWindowIcon() { | 471 void OpaqueNonClientView::UpdateWindowIcon() { |
| 470 if (window_icon_) | 472 if (window_icon_) |
| 471 window_icon_->Update(); | 473 window_icon_->Update(); |
| 472 } | 474 } |
| 473 | 475 |
| 474 /////////////////////////////////////////////////////////////////////////////// | 476 /////////////////////////////////////////////////////////////////////////////// |
| 475 // OpaqueNonClientView, TabIconView::TabContentsProvider implementation: | 477 // OpaqueNonClientView, TabIconView::TabContentsProvider implementation: |
| 476 | 478 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 495 } else if (sender == close_button_) { | 497 } else if (sender == close_button_) { |
| 496 frame_->ExecuteSystemMenuCommand(SC_CLOSE); | 498 frame_->ExecuteSystemMenuCommand(SC_CLOSE); |
| 497 } | 499 } |
| 498 } | 500 } |
| 499 | 501 |
| 500 /////////////////////////////////////////////////////////////////////////////// | 502 /////////////////////////////////////////////////////////////////////////////// |
| 501 // OpaqueNonClientView, ChromeViews::NonClientView implementation: | 503 // OpaqueNonClientView, ChromeViews::NonClientView implementation: |
| 502 | 504 |
| 503 gfx::Rect OpaqueNonClientView::CalculateClientAreaBounds(int width, | 505 gfx::Rect OpaqueNonClientView::CalculateClientAreaBounds(int width, |
| 504 int height) const { | 506 int height) const { |
| 505 int top_margin = CalculateNonClientTopHeight(); | 507 return gfx::Rect(kWindowHorizontalBorderSize, 0, |
| 506 return gfx::Rect(kWindowHorizontalBorderSize, top_margin, | |
| 507 std::max(0, width - (2 * kWindowHorizontalBorderSize)), | 508 std::max(0, width - (2 * kWindowHorizontalBorderSize)), |
| 508 std::max(0, height - top_margin - kWindowVerticalBorderBottomSize)); | 509 std::max(0, height - kWindowVerticalBorderBottomSize)); |
| 509 } | 510 } |
| 510 | 511 |
| 511 gfx::Size OpaqueNonClientView::CalculateWindowSizeForClientSize( | 512 gfx::Size OpaqueNonClientView::CalculateWindowSizeForClientSize( |
| 512 int width, | 513 int width, |
| 513 int height) const { | 514 int height) const { |
| 514 int top_margin = CalculateNonClientTopHeight(); | 515 int top_margin = CalculateNonClientTopHeight(); |
| 515 return gfx::Size(width + (2 * kWindowHorizontalBorderSize), | 516 return gfx::Size(width + (2 * kWindowHorizontalBorderSize), |
| 516 height + top_margin + kWindowVerticalBorderBottomSize); | 517 height + top_margin + kWindowVerticalBorderBottomSize); |
| 517 } | 518 } |
| 518 | 519 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 | 1035 |
| 1035 // static | 1036 // static |
| 1036 void OpaqueNonClientView::InitAppWindowResources() { | 1037 void OpaqueNonClientView::InitAppWindowResources() { |
| 1037 static bool initialized = false; | 1038 static bool initialized = false; |
| 1038 if (!initialized) { | 1039 if (!initialized) { |
| 1039 title_font_ = ResourceBundle::GetSharedInstance().GetFont( | 1040 title_font_ = ResourceBundle::GetSharedInstance().GetFont( |
| 1040 ResourceBundle::BaseFont).DeriveFont(1, ChromeFont::BOLD); | 1041 ResourceBundle::BaseFont).DeriveFont(1, ChromeFont::BOLD); |
| 1041 initialized = true; | 1042 initialized = true; |
| 1042 } | 1043 } |
| 1043 } | 1044 } |
| OLD | NEW |