diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-29 17:51:45 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-29 17:51:45 +0000 |
commit | 3216fbdae4d6887bc87240879530fb9f688d013b (patch) | |
tree | 9f93e158a253b1d1c9a9e7b1580db4fb5fa5aec7 | |
parent | 1b283269dc993a2684e506a144d76c186eb61fca (diff) | |
download | chromium_src-3216fbdae4d6887bc87240879530fb9f688d013b.zip chromium_src-3216fbdae4d6887bc87240879530fb9f688d013b.tar.gz chromium_src-3216fbdae4d6887bc87240879530fb9f688d013b.tar.bz2 |
Move kClientEdgeThickness from BrowserView to NonClientView (which makes more sense anyway) so I'll be able to use it in custom_frame_window.cc.
Also eliminate an unnecessarily-repeated set of resource IDs from the opaque nonclient view, and move a comment to match what I ended up doing (but haven't yet sent up for review) in other places. Seems I couldn't make up my mind on that one.
Review URL: http://codereview.chromium.org/19458
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8891 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 1 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 31 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 4 | ||||
-rw-r--r-- | chrome/views/non_client_view.cc | 2 | ||||
-rw-r--r-- | chrome/views/non_client_view.h | 4 |
6 files changed, 19 insertions, 27 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 0d20e835e..5197b34 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -57,7 +57,6 @@ using base::TimeDelta; // static SkBitmap BrowserView::default_favicon_; SkBitmap BrowserView::otr_avatar_; -const int BrowserView::kClientEdgeThickness = 1; // The vertical overlap between the TabStrip and the Toolbar. static const int kToolbarTabStripVerticalOverlap = 3; // The visible height of the shadow above the tabs. Clicks in this area are diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index c29ff04..7be0501 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -43,10 +43,6 @@ class BrowserView : public BrowserWindow, public views::WindowDelegate, public views::ClientView { public: - // In restored mode, we draw a 1 px edge around the content area inside the - // frame border. - static const int kClientEdgeThickness; - // Explicitly sets how windows are shown. Use a value of -1 to give the // default behavior. This is used during testing and not generally useful // otherwise. diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 344b35c..89efb7f 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -49,10 +49,6 @@ enum { FRAME_TOP_LEFT_CORNER, FRAME_TOP_RIGHT_CORNER, - // Window Maximized Border. - FRAME_MAXIMIZED_TOP_EDGE, - FRAME_MAXIMIZED_BOTTOM_EDGE, - // Client Edge Border. FRAME_CLIENT_EDGE_TOP_LEFT, FRAME_CLIENT_EDGE_TOP, @@ -97,7 +93,6 @@ class ActiveWindowResources : public views::WindowResources { IDR_WINDOW_BOTTOM_RIGHT_CORNER, IDR_WINDOW_LEFT_SIDE, IDR_WINDOW_RIGHT_SIDE, IDR_WINDOW_TOP_CENTER, IDR_WINDOW_TOP_LEFT_CORNER, IDR_WINDOW_TOP_RIGHT_CORNER, - IDR_WINDOW_TOP_CENTER, IDR_WINDOW_BOTTOM_CENTER, IDR_CONTENT_TOP_LEFT_CORNER, IDR_CONTENT_TOP_CENTER, IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, @@ -149,7 +144,6 @@ class InactiveWindowResources : public views::WindowResources { IDR_DEWINDOW_BOTTOM_RIGHT_CORNER, IDR_DEWINDOW_LEFT_SIDE, IDR_DEWINDOW_RIGHT_SIDE, IDR_DEWINDOW_TOP_CENTER, IDR_DEWINDOW_TOP_LEFT_CORNER, IDR_DEWINDOW_TOP_RIGHT_CORNER, - IDR_DEWINDOW_TOP_CENTER, IDR_DEWINDOW_BOTTOM_CENTER, IDR_CONTENT_TOP_LEFT_CORNER, IDR_CONTENT_TOP_CENTER, IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, @@ -201,7 +195,6 @@ class OTRActiveWindowResources : public views::WindowResources { IDR_WINDOW_BOTTOM_RIGHT_CORNER_OTR, IDR_WINDOW_LEFT_SIDE_OTR, IDR_WINDOW_RIGHT_SIDE_OTR, IDR_WINDOW_TOP_CENTER_OTR, IDR_WINDOW_TOP_LEFT_CORNER_OTR, IDR_WINDOW_TOP_RIGHT_CORNER_OTR, - IDR_WINDOW_TOP_CENTER_OTR, IDR_WINDOW_BOTTOM_CENTER_OTR, IDR_CONTENT_TOP_LEFT_CORNER, IDR_CONTENT_TOP_CENTER, IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, @@ -253,7 +246,6 @@ class OTRInactiveWindowResources : public views::WindowResources { IDR_DEWINDOW_RIGHT_SIDE_OTR, IDR_DEWINDOW_TOP_CENTER_OTR, IDR_DEWINDOW_TOP_LEFT_CORNER_OTR, IDR_DEWINDOW_TOP_RIGHT_CORNER_OTR, - IDR_DEWINDOW_TOP_CENTER_OTR, IDR_DEWINDOW_BOTTOM_CENTER_OTR, IDR_CONTENT_TOP_LEFT_CORNER, IDR_CONTENT_TOP_CENTER, IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, @@ -717,7 +709,7 @@ int OpaqueNonClientView::TopResizeHeight() const { int OpaqueNonClientView::NonClientBorderWidth() const { // In maximized mode, we don't show a client edge. return FrameBorderWidth() + - (frame_->IsMaximized() ? 0 : BrowserView::kClientEdgeThickness); + (frame_->IsMaximized() ? 0 : kClientEdgeThickness); } int OpaqueNonClientView::NonClientTopBorderHeight() const { @@ -735,14 +727,14 @@ int OpaqueNonClientView::NonClientBottomBorderHeight() const { // extended slightly. return frame_->IsMaximized() ? (GetSystemMetrics(SM_CYSIZEFRAME) + kFrameBorderMaximizedExtraBottomThickness) : - (kFrameBorderThickness + BrowserView::kClientEdgeThickness); + (kFrameBorderThickness + kClientEdgeThickness); } int OpaqueNonClientView::BottomEdgeThicknessWithinNonClientHeight() const { if (browser_view_->IsToolbarVisible()) return 0; return kFrameShadowThickness + - (frame_->IsMaximized() ? 0 : BrowserView::kClientEdgeThickness); + (frame_->IsMaximized() ? 0 : kClientEdgeThickness); } int OpaqueNonClientView::TitleCoordinates(int* title_top_spacing, @@ -821,7 +813,7 @@ void OpaqueNonClientView::PaintRestoredFrameBorder(ChromeCanvas* canvas) { } void OpaqueNonClientView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) { - SkBitmap* top_edge = resources()->GetPartBitmap(FRAME_MAXIMIZED_TOP_EDGE); + SkBitmap* top_edge = resources()->GetPartBitmap(FRAME_TOP_EDGE); canvas->TileImageInt(*top_edge, 0, FrameTopBorderHeight(), width(), top_edge->height()); @@ -829,14 +821,12 @@ void OpaqueNonClientView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) { // There's no toolbar to edge the frame border, so we need to draw a bottom // edge. The App Window graphic we use for this has a built in client edge, // so we clip it off the bottom. - int edge_height = - app_top_center_.height() - BrowserView::kClientEdgeThickness; + int edge_height = app_top_center_.height() - kClientEdgeThickness; canvas->TileImageInt(app_top_center_, 0, frame_->client_view()->y() - edge_height, width(), edge_height); } - SkBitmap* bottom_edge = - resources()->GetPartBitmap(FRAME_MAXIMIZED_BOTTOM_EDGE); + SkBitmap* bottom_edge = resources()->GetPartBitmap(FRAME_BOTTOM_EDGE); // We draw the bottom edge of this image. canvas->TileImageInt(*bottom_edge, 0, bottom_edge->height() - kFrameBorderMaximizedExtraBottomThickness, 0, @@ -926,14 +916,15 @@ void OpaqueNonClientView::PaintRestoredClientEdge(ChromeCanvas* canvas) { // // To address this, we extend the left and right client edges up to fill the // gap, by pretending the toolbar is shorter than it really is. - client_area_top -= BrowserView::kClientEdgeThickness; + client_area_top -= kClientEdgeThickness; } else { // The toolbar isn't going to draw a client edge for us, so draw one // ourselves. + // This next calculation is necessary because the top center bitmap is + // shorter than the top left and right bitmaps. We need their top edges to + // line up, and we need the left and right edges to start below the corners' + // bottoms. int top_edge_y = client_area_top - app_top_center_.height(); - // This is necessary because the top center bitmap is shorter than the top - // left and right bitmaps. We need their top edges to line up, and we - // need the left and right edges to start below the corners' bottoms. client_area_top = top_edge_y + app_top_left_.height(); canvas->DrawBitmapInt(app_top_left_, client_area_bounds.x() - app_top_left_.width(), diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index fdfd2fd..aed2a73 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -22,7 +22,6 @@ #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/user_data_manager.h" #include "chrome/browser/views/dom_view.h" -#include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/go_button.h" #include "chrome/browser/views/location_bar_view.h" #include "chrome/browser/views/theme_helpers.h" @@ -40,6 +39,7 @@ #include "chrome/views/button_dropdown.h" #include "chrome/views/hwnd_view.h" #include "chrome/views/label.h" +#include "chrome/views/non_client_view.h" #include "chrome/views/tooltip_manager.h" #include "chrome/views/widget.h" #include "net/base/net_util.h" @@ -487,7 +487,7 @@ gfx::Size BrowserToolbarView::GetPreferredSize() { // prevents the content area from being off by |kClientEdgeThickness| px. int client_edge_height = (browser_->window() && browser_->window()->IsMaximized()) ? - 0 : BrowserView::kClientEdgeThickness; + 0 : views::NonClientView::kClientEdgeThickness; return gfx::Size(0, location_bar_->GetPreferredSize().height() + client_edge_height); } diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index 3e1ebde..2690a2d 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -6,6 +6,8 @@ namespace views { +const int NonClientView::kClientEdgeThickness = 1; + int NonClientView::GetHTComponentForFrame(const gfx::Point& point, int top_resize_border_height, int resize_border_width, diff --git a/chrome/views/non_client_view.h b/chrome/views/non_client_view.h index 3643bbe..6619cf0 100644 --- a/chrome/views/non_client_view.h +++ b/chrome/views/non_client_view.h @@ -27,6 +27,10 @@ class ClientView; // class NonClientView : public View { public: + // In restored mode, we draw a 1 px edge around the content area inside the + // frame border. + static const int kClientEdgeThickness; + // Calculates the bounds of the client area of the window assuming the // window is sized to |width| and |height|. virtual gfx::Rect CalculateClientAreaBounds(int width, |