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

Side by Side Diff: chrome/browser/chromeos/frame/normal_browser_frame_view.cc

Issue 3167027: Merge 56737 - Fix numerous alignment problems, both horizontal and vertical, ... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromeos/frame/normal_browser_frame_view.h" 5 #include "chrome/browser/chromeos/frame/normal_browser_frame_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "app/theme_provider.h" 9 #include "app/theme_provider.h"
10 #include "app/x11_util.h" 10 #include "app/x11_util.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 gfx::Rect NormalBrowserFrameView::GetBoundsForTabStrip( 85 gfx::Rect NormalBrowserFrameView::GetBoundsForTabStrip(
86 BaseTabStrip* tabstrip) const { 86 BaseTabStrip* tabstrip) const {
87 int border_thickness = FrameBorderThickness(); 87 int border_thickness = FrameBorderThickness();
88 if (browser_view_->UseVerticalTabs()) { 88 if (browser_view_->UseVerticalTabs()) {
89 // BrowserViewLayout adjusts the height/width based on the status area and 89 // BrowserViewLayout adjusts the height/width based on the status area and
90 // otr icon. 90 // otr icon.
91 gfx::Size ps = tabstrip->GetPreferredSize(); 91 gfx::Size ps = tabstrip->GetPreferredSize();
92 return gfx::Rect(border_thickness, NonClientTopBorderHeight(), 92 return gfx::Rect(border_thickness, NonClientTopBorderHeight(),
93 ps.width(), browser_view_->height()); 93 ps.width(), browser_view_->height());
94 } 94 }
95 return gfx::Rect(border_thickness, NonClientTopBorderHeight(), 95 return gfx::Rect(border_thickness, GetHorizontalTabStripVerticalOffset(false),
96 std::max(0, width() - (2 * border_thickness)), 96 std::max(0, width() - (2 * border_thickness)),
97 tabstrip->GetPreferredHeight()); 97 tabstrip->GetPreferredHeight());
98 } 98 }
99 99
100 int NormalBrowserFrameView::GetHorizontalTabStripVerticalOffset(
101 bool restored) const {
102 return NonClientTopBorderHeight();
103 }
104
100 void NormalBrowserFrameView::UpdateThrobber(bool running) { 105 void NormalBrowserFrameView::UpdateThrobber(bool running) {
101 // No window icon. 106 // No window icon.
102 } 107 }
103 108
104 gfx::Size NormalBrowserFrameView::GetMinimumSize() { 109 gfx::Size NormalBrowserFrameView::GetMinimumSize() {
105 gfx::Size min_size(browser_view_->GetMinimumSize()); 110 gfx::Size min_size(browser_view_->GetMinimumSize());
106 int border_thickness = FrameBorderThickness(); 111 int border_thickness = FrameBorderThickness();
107 min_size.Enlarge(2 * border_thickness, 112 min_size.Enlarge(2 * border_thickness,
108 NonClientTopBorderHeight() + border_thickness); 113 NonClientTopBorderHeight() + border_thickness);
109 114
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return std::max(0, FrameBorderThickness() - 255 return std::max(0, FrameBorderThickness() -
251 (browser_view_->IsTabStripVisible() ? kTabstripTopShadowThickness : 0)); 256 (browser_view_->IsTabStripVisible() ? kTabstripTopShadowThickness : 0));
252 } 257 }
253 258
254 void NormalBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { 259 void NormalBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) {
255 ThemeProvider* tp = GetThemeProvider(); 260 ThemeProvider* tp = GetThemeProvider();
256 views::Window* window = frame_->GetWindow(); 261 views::Window* window = frame_->GetWindow();
257 262
258 // Window frame mode and color 263 // Window frame mode and color
259 SkBitmap* theme_frame; 264 SkBitmap* theme_frame;
260 int y = 0; 265 // HACK: This is to properly align the frame background with the tab
266 // background. This was added because when this code was copied from the
267 // opaque frame code, that code didn't correctly handle maximized mode theme
268 // alignment. That bug has since been fixed in a more general but more
269 // complex way in the opaque frame. Since this file is eventually going to
270 // die (see crbug.com/52674), I'm just leaving this here rather than replacing
271 // it with the complex fix.
272 int y = -kCustomFrameBackgroundVerticalOffset;
261 // Never theme app and popup windows. 273 // Never theme app and popup windows.
262 if (!browser_view_->IsBrowserTypeNormal()) { 274 if (!browser_view_->IsBrowserTypeNormal()) {
263 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 275 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
264 theme_frame = rb.GetBitmapNamed(ShouldPaintAsActive() ? 276 theme_frame = rb.GetBitmapNamed(ShouldPaintAsActive() ?
265 IDR_FRAME : IDR_FRAME_INACTIVE); 277 IDR_FRAME : IDR_FRAME_INACTIVE);
278 y = 0; // These are never themed.
266 } else if (!browser_view_->IsOffTheRecord()) { 279 } else if (!browser_view_->IsOffTheRecord()) {
267 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ? 280 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ?
268 IDR_THEME_FRAME : IDR_THEME_FRAME_INACTIVE); 281 IDR_THEME_FRAME : IDR_THEME_FRAME_INACTIVE);
269 // TODO(oshima): gtk based CHROMEOS is using non custom frame
270 // mode which does this adjustment. This should be removed
271 // once it's fully migrated to views. -1 is due to the layout
272 // difference between views and gtk and will be removed.
273 // See http://crbug.com/28580.
274 y = -kCustomFrameBackgroundVerticalOffset - 1;
275 } else { 282 } else {
276 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ? 283 theme_frame = tp->GetBitmapNamed(ShouldPaintAsActive() ?
277 IDR_THEME_FRAME_INCOGNITO: IDR_THEME_FRAME_INCOGNITO_INACTIVE); 284 IDR_THEME_FRAME_INCOGNITO: IDR_THEME_FRAME_INCOGNITO_INACTIVE);
278 y = -kCustomFrameBackgroundVerticalOffset - 1;
279 } 285 }
280 // Draw the theme frame. 286 // Draw the theme frame. It must be aligned with the tabstrip as if we were
287 // in restored mode. Note that the top of the tabstrip is
288 // kTabstripTopShadowThickness px off the top of the screen.
281 canvas->TileImageInt(*theme_frame, 0, y, width(), theme_frame->height()); 289 canvas->TileImageInt(*theme_frame, 0, y, width(), theme_frame->height());
282 290
283 // Draw the theme frame overlay 291 // Draw the theme frame overlay
284 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 292 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
285 browser_view_->IsBrowserTypeNormal()) { 293 browser_view_->IsBrowserTypeNormal()) {
286 SkBitmap* theme_overlay = tp->GetBitmapNamed(ShouldPaintAsActive() ? 294 SkBitmap* theme_overlay = tp->GetBitmapNamed(ShouldPaintAsActive() ?
287 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); 295 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE);
288 canvas->DrawBitmapInt(*theme_overlay, 0, 0); 296 canvas->DrawBitmapInt(*theme_overlay, 0, y);
289 } 297 }
290 298
291 if (!browser_view_->IsToolbarVisible()) { 299 if (!browser_view_->IsToolbarVisible()) {
292 // There's no toolbar to edge the frame border, so we need to draw a bottom 300 // There's no toolbar to edge the frame border, so we need to draw a bottom
293 // edge. The graphic we use for this has a built in client edge, so we clip 301 // edge. The graphic we use for this has a built in client edge, so we clip
294 // it off the bottom. 302 // it off the bottom.
295 SkBitmap* top_center = 303 SkBitmap* top_center =
296 tp->GetBitmapNamed(IDR_APP_TOP_CENTER); 304 tp->GetBitmapNamed(IDR_APP_TOP_CENTER);
297 int edge_height = top_center->height() - kClientEdgeThickness; 305 int edge_height = top_center->height() - kClientEdgeThickness;
298 canvas->TileImageInt(*top_center, 0, 306 canvas->TileImageInt(*top_center, 0,
(...skipping 23 matching lines...) Expand all
322 int bottom_y = toolbar_bounds.y() + split_point; 330 int bottom_y = toolbar_bounds.y() + split_point;
323 SkBitmap* toolbar_left = 331 SkBitmap* toolbar_left =
324 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); 332 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER);
325 int bottom_edge_height = 333 int bottom_edge_height =
326 std::min(toolbar_left->height(), toolbar_bounds.height()) - split_point; 334 std::min(toolbar_left->height(), toolbar_bounds.height()) - split_point;
327 335
328 SkColor theme_toolbar_color = 336 SkColor theme_toolbar_color =
329 tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); 337 tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR);
330 canvas->FillRectInt(theme_toolbar_color, toolbar_bounds.x(), bottom_y, 338 canvas->FillRectInt(theme_toolbar_color, toolbar_bounds.x(), bottom_y,
331 toolbar_bounds.width(), bottom_edge_height); 339 toolbar_bounds.width(), bottom_edge_height);
332 toolbar_bounds.Inset(-kClientEdgeThickness, 0);
333 340
334 int strip_height = browser_view_->GetTabStripHeight(); 341 int strip_height = browser_view_->GetTabStripHeight();
335 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); 342 SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR);
336 343
337 canvas->TileImageInt(*theme_toolbar, toolbar_bounds.x(), 344 canvas->TileImageInt(*theme_toolbar, toolbar_bounds.x(),
338 strip_height - kFrameShadowThickness, toolbar_bounds.x(), 345 strip_height - kFrameShadowThickness, toolbar_bounds.x(), bottom_y,
339 bottom_y, toolbar_bounds.width(), theme_toolbar->height()); 346 toolbar_bounds.width(), theme_toolbar->height());
340 347
341 canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point, 348 canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point,
342 toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y(), 349 toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y(),
343 toolbar_left->width(), split_point, false); 350 toolbar_left->width(), split_point, false);
344 canvas->DrawBitmapInt(*toolbar_left, 0, 351 canvas->DrawBitmapInt(*toolbar_left, 0,
345 toolbar_left->height() - bottom_edge_height, toolbar_left->width(), 352 toolbar_left->height() - bottom_edge_height, toolbar_left->width(),
346 bottom_edge_height, toolbar_bounds.x() - toolbar_left->width(), bottom_y, 353 bottom_edge_height, toolbar_bounds.x() - toolbar_left->width(), bottom_y,
347 toolbar_left->width(), bottom_edge_height, false); 354 toolbar_left->width(), bottom_edge_height, false);
348 355
349 SkBitmap* toolbar_center = 356 SkBitmap* toolbar_center =
(...skipping 10 matching lines...) Expand all
360 bottom_edge_height, toolbar_bounds.right(), bottom_y, 367 bottom_edge_height, toolbar_bounds.right(), bottom_y,
361 toolbar_right->width(), bottom_edge_height, false); 368 toolbar_right->width(), bottom_edge_height, false);
362 369
363 // Draw the content/toolbar separator. 370 // Draw the content/toolbar separator.
364 canvas->FillRectInt(ResourceBundle::toolbar_separator_color, 371 canvas->FillRectInt(ResourceBundle::toolbar_separator_color,
365 toolbar_bounds.x(), toolbar_bounds.bottom() - kClientEdgeThickness, 372 toolbar_bounds.x(), toolbar_bounds.bottom() - kClientEdgeThickness,
366 toolbar_bounds.width(), kClientEdgeThickness); 373 toolbar_bounds.width(), kClientEdgeThickness);
367 } 374 }
368 375
369 } // namespace chromeos 376 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/frame/normal_browser_frame_view.h ('k') | chrome/browser/views/detachable_toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698