OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 // Draw center edge. | 324 // Draw center edge. |
325 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, | 325 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, |
326 right_x - (left_x + toolbar_left->width()), toolbar_center->height()); | 326 right_x - (left_x + toolbar_left->width()), toolbar_center->height()); |
327 | 327 |
328 // Right edge. | 328 // Right edge. |
329 canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | 329 canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), |
330 right_x, y); | 330 right_x, y); |
331 | 331 |
332 // Draw the content/toolbar separator. | 332 // Draw the content/toolbar separator. |
333 canvas->FillRectInt(ResourceBundle::toolbar_separator_color, | 333 canvas->FillRect(ResourceBundle::toolbar_separator_color, |
334 x + kClientEdgeThickness, toolbar_bounds.bottom() - kClientEdgeThickness, | 334 gfx::Rect(x + kClientEdgeThickness, |
335 w - (2 * kClientEdgeThickness), kClientEdgeThickness); | 335 toolbar_bounds.bottom() - kClientEdgeThickness, |
| 336 w - (2 * kClientEdgeThickness), |
| 337 kClientEdgeThickness)); |
336 } | 338 } |
337 | 339 |
338 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { | 340 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { |
339 ui::ThemeProvider* tp = GetThemeProvider(); | 341 ui::ThemeProvider* tp = GetThemeProvider(); |
340 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); | 342 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); |
341 | 343 |
342 // The client edges start below the toolbar upper corner images regardless | 344 // The client edges start below the toolbar upper corner images regardless |
343 // of how tall the toolbar itself is. | 345 // of how tall the toolbar itself is. |
344 int client_area_top = frame_->client_view()->y() + | 346 int client_area_top = frame_->client_view()->y() + |
345 browser_view_->GetToolbarBounds().y() + | 347 browser_view_->GetToolbarBounds().y() + |
(...skipping 19 matching lines...) Expand all Loading... |
365 client_area_bounds.x() - bottom_left->width(), client_area_bottom); | 367 client_area_bounds.x() - bottom_left->width(), client_area_bottom); |
366 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); | 368 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); |
367 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), | 369 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), |
368 client_area_top, left->width(), client_area_height); | 370 client_area_top, left->width(), client_area_height); |
369 | 371 |
370 // Draw the toolbar color so that the client edges show the right color even | 372 // Draw the toolbar color so that the client edges show the right color even |
371 // where not covered by the toolbar image. NOTE: We do this after drawing the | 373 // where not covered by the toolbar image. NOTE: We do this after drawing the |
372 // images because the images are meant to alpha-blend atop the frame whereas | 374 // images because the images are meant to alpha-blend atop the frame whereas |
373 // these rects are meant to be fully opaque, without anything overlaid. | 375 // these rects are meant to be fully opaque, without anything overlaid. |
374 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); | 376 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); |
375 canvas->FillRectInt(toolbar_color, | 377 canvas->FillRect(toolbar_color, |
376 client_area_bounds.x() - kClientEdgeThickness, client_area_top, | 378 gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, client_area_top, |
377 kClientEdgeThickness, | 379 kClientEdgeThickness, |
378 client_area_bottom + kClientEdgeThickness - client_area_top); | 380 client_area_bottom + kClientEdgeThickness - client_area_top)); |
379 canvas->FillRectInt(toolbar_color, client_area_bounds.x(), client_area_bottom, | 381 canvas->FillRect(toolbar_color, |
380 client_area_bounds.width(), kClientEdgeThickness); | 382 gfx::Rect(client_area_bounds.x(), client_area_bottom, |
381 canvas->FillRectInt(toolbar_color, client_area_bounds.right(), | 383 client_area_bounds.width(), kClientEdgeThickness)); |
382 client_area_top, kClientEdgeThickness, | 384 canvas->FillRect(toolbar_color, gfx::Rect(client_area_bounds.right(), |
383 client_area_bottom + kClientEdgeThickness - client_area_top); | 385 client_area_top, kClientEdgeThickness, |
| 386 client_area_bottom + kClientEdgeThickness - client_area_top)); |
384 } | 387 } |
385 | 388 |
386 void GlassBrowserFrameView::LayoutAvatar() { | 389 void GlassBrowserFrameView::LayoutAvatar() { |
387 // Even though the avatar is used for both incognito and profiles we always | 390 // Even though the avatar is used for both incognito and profiles we always |
388 // use the incognito icon to layout the avatar button. The profile icon | 391 // use the incognito icon to layout the avatar button. The profile icon |
389 // can be customized so we can't depend on its size to perform layout. | 392 // can be customized so we can't depend on its size to perform layout. |
390 SkBitmap incognito_icon = browser_view_->GetOTRAvatarIcon(); | 393 SkBitmap incognito_icon = browser_view_->GetOTRAvatarIcon(); |
391 | 394 |
392 int avatar_x = NonClientBorderThickness() + kAvatarSideSpacing; | 395 int avatar_x = NonClientBorderThickness() + kAvatarSideSpacing; |
393 // Move this avatar icon by the size of window controls to prevent it from | 396 // Move this avatar icon by the size of window controls to prevent it from |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 ProfileInfoCache& cache = | 532 ProfileInfoCache& cache = |
530 g_browser_process->profile_manager()->GetProfileInfoCache(); | 533 g_browser_process->profile_manager()->GetProfileInfoCache(); |
531 Profile* profile = browser_view_->browser()->profile(); | 534 Profile* profile = browser_view_->browser()->profile(); |
532 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 535 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
533 if (index != std::string::npos) { | 536 if (index != std::string::npos) { |
534 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); | 537 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); |
535 avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index)); | 538 avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index)); |
536 } | 539 } |
537 } | 540 } |
538 } | 541 } |
OLD | NEW |