| OLD | NEW |
| 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/views/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/glass_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "app/theme_provider.h" | 8 #include "app/theme_provider.h" |
| 9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
| 10 #include "chrome/browser/browser_theme_provider.h" | 10 #include "chrome/browser/browser_theme_provider.h" |
| 11 #include "chrome/browser/views/frame/browser_view.h" | 11 #include "chrome/browser/views/frame/browser_view.h" |
| 12 #include "chrome/browser/views/tabs/side_tab_strip.h" | 12 #include "chrome/browser/views/tabs/side_tab_strip.h" |
| 13 #include "chrome/browser/views/tabs/tab.h" | 13 #include "chrome/browser/views/tabs/tab.h" |
| 14 #include "chrome/browser/views/tabs/tab_strip.h" | 14 #include "chrome/browser/views/tabs/tab_strip.h" |
| 15 #include "gfx/canvas.h" | 15 #include "gfx/canvas_skia.h" |
| 16 #include "gfx/icon_util.h" | 16 #include "gfx/icon_util.h" |
| 17 #include "grit/app_resources.h" | 17 #include "grit/app_resources.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "views/window/client_view.h" | 19 #include "views/window/client_view.h" |
| 20 #include "views/window/window_resources.h" | 20 #include "views/window/window_resources.h" |
| 21 | 21 |
| 22 HICON GlassBrowserFrameView::throbber_icons_[ | 22 HICON GlassBrowserFrameView::throbber_icons_[ |
| 23 GlassBrowserFrameView::kThrobberIconCount]; | 23 GlassBrowserFrameView::kThrobberIconCount]; |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 int y = tabstrip_bounds.y(); | 257 int y = tabstrip_bounds.y(); |
| 258 int w = toolbar_bounds.right() - x; | 258 int w = toolbar_bounds.right() - x; |
| 259 | 259 |
| 260 int src_y = Tab::GetMinimumUnselectedSize().height(); | 260 int src_y = Tab::GetMinimumUnselectedSize().height(); |
| 261 canvas->TileImageInt(*theme_toolbar, 0, src_y, | 261 canvas->TileImageInt(*theme_toolbar, 0, src_y, |
| 262 MirroredLeftPointForRect(toolbar_bounds), y, | 262 MirroredLeftPointForRect(toolbar_bounds), y, |
| 263 toolbar_bounds.width(), theme_toolbar->height()); | 263 toolbar_bounds.width(), theme_toolbar->height()); |
| 264 | 264 |
| 265 // Draw left edge. We explicitly set a clip as the image is bigger than just | 265 // Draw left edge. We explicitly set a clip as the image is bigger than just |
| 266 // the corner. | 266 // the corner. |
| 267 canvas->save(); | 267 canvas->AsCanvasSkia()->save(); |
| 268 canvas->ClipRectInt(x - kNonClientBorderThickness, | 268 canvas->ClipRectInt(x - kNonClientBorderThickness, |
| 269 y - kNonClientBorderThickness, | 269 y - kNonClientBorderThickness, |
| 270 kNonClientBorderThickness, | 270 kNonClientBorderThickness, |
| 271 kNonClientBorderThickness); | 271 kNonClientBorderThickness); |
| 272 canvas->DrawBitmapInt(*toolbar_left, x - kNonClientBorderThickness, | 272 canvas->DrawBitmapInt(*toolbar_left, x - kNonClientBorderThickness, |
| 273 y - kNonClientBorderThickness); | 273 y - kNonClientBorderThickness); |
| 274 canvas->restore(); | 274 canvas->AsCanvasSkia()->restore(); |
| 275 | 275 |
| 276 // Draw center edge. We need to draw a while line above the toolbar for the | 276 // Draw center edge. We need to draw a while line above the toolbar for the |
| 277 // image to overlay nicely. | 277 // image to overlay nicely. |
| 278 canvas->FillRectInt(SK_ColorWHITE, x, y - 1, w, 1); | 278 canvas->FillRectInt(SK_ColorWHITE, x, y - 1, w, 1); |
| 279 canvas->TileImageInt(*toolbar_center, x, y - kNonClientBorderThickness, w, | 279 canvas->TileImageInt(*toolbar_center, x, y - kNonClientBorderThickness, w, |
| 280 toolbar_center->height()); | 280 toolbar_center->height()); |
| 281 // Right edge. Again, we have to clip because of image size. | 281 // Right edge. Again, we have to clip because of image size. |
| 282 canvas->save(); | 282 canvas->AsCanvasSkia()->save(); |
| 283 canvas->ClipRectInt(x + w - kNonClientBorderThickness, | 283 canvas->ClipRectInt(x + w - kNonClientBorderThickness, |
| 284 y - kNonClientBorderThickness, | 284 y - kNonClientBorderThickness, |
| 285 kNonClientBorderThickness, | 285 kNonClientBorderThickness, |
| 286 kNonClientBorderThickness); | 286 kNonClientBorderThickness); |
| 287 canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | 287 canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), |
| 288 x + w, y); | 288 x + w, y); |
| 289 canvas->restore(); | 289 canvas->AsCanvasSkia()->restore(); |
| 290 } else { | 290 } else { |
| 291 // Draw the toolbar background, setting src_y of the paint to the tab | 291 // Draw the toolbar background, setting src_y of the paint to the tab |
| 292 // strip height as the toolbar background begins at the top of the tabs. | 292 // strip height as the toolbar background begins at the top of the tabs. |
| 293 int src_y = browser_view_->GetTabStripHeight() - 1; | 293 int src_y = browser_view_->GetTabStripHeight() - 1; |
| 294 canvas->TileImageInt(*theme_toolbar, 0, src_y, | 294 canvas->TileImageInt(*theme_toolbar, 0, src_y, |
| 295 toolbar_bounds.x() - 1, toolbar_bounds.y() + 2, | 295 toolbar_bounds.x() - 1, toolbar_bounds.y() + 2, |
| 296 toolbar_bounds.width() + 2, theme_toolbar->height()); | 296 toolbar_bounds.width() + 2, theme_toolbar->height()); |
| 297 // Draw rounded corners for the tab. | 297 // Draw rounded corners for the tab. |
| 298 SkBitmap* toolbar_left_mask = | 298 SkBitmap* toolbar_left_mask = |
| 299 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); | 299 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 int dst_x = MirroredLeftPointForRect(otr_avatar_bounds_); | 349 int dst_x = MirroredLeftPointForRect(otr_avatar_bounds_); |
| 350 int dst_y = otr_avatar_bounds_.y(); | 350 int dst_y = otr_avatar_bounds_.y(); |
| 351 int w = otr_avatar_bounds_.width(); | 351 int w = otr_avatar_bounds_.width(); |
| 352 int h = otr_avatar_bounds_.height(); | 352 int h = otr_avatar_bounds_.height(); |
| 353 if (browser_view_->UseVerticalTabs()) { | 353 if (browser_view_->UseVerticalTabs()) { |
| 354 // Only a portion of the otr icon is visible for vertical tabs. Clip it | 354 // Only a portion of the otr icon is visible for vertical tabs. Clip it |
| 355 // so that it doesn't overlap shadows. | 355 // so that it doesn't overlap shadows. |
| 356 gfx::Point tabstrip_origin(browser_view_->tabstrip()->bounds().origin()); | 356 gfx::Point tabstrip_origin(browser_view_->tabstrip()->bounds().origin()); |
| 357 View::ConvertPointToView(frame_->GetWindow()->GetClientView(), this, | 357 View::ConvertPointToView(frame_->GetWindow()->GetClientView(), this, |
| 358 &tabstrip_origin); | 358 &tabstrip_origin); |
| 359 canvas->save(); | 359 canvas->AsCanvasSkia()->save(); |
| 360 canvas->ClipRectInt(dst_x, 2, w, tabstrip_origin.y() - 4); | 360 canvas->ClipRectInt(dst_x, 2, w, tabstrip_origin.y() - 4); |
| 361 canvas->DrawBitmapInt(otr_avatar_icon, src_x, src_y, w, h, dst_x, dst_y, | 361 canvas->DrawBitmapInt(otr_avatar_icon, src_x, src_y, w, h, dst_x, dst_y, |
| 362 w, h, false); | 362 w, h, false); |
| 363 canvas->restore(); | 363 canvas->AsCanvasSkia()->restore(); |
| 364 } else { | 364 } else { |
| 365 canvas->DrawBitmapInt(otr_avatar_icon, src_x, src_y, w, h, dst_x, dst_y, | 365 canvas->DrawBitmapInt(otr_avatar_icon, src_x, src_y, w, h, dst_x, dst_y, |
| 366 w, h, false); | 366 w, h, false); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 | 369 |
| 370 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { | 370 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { |
| 371 ThemeProvider* tp = GetThemeProvider(); | 371 ThemeProvider* tp = GetThemeProvider(); |
| 372 | 372 |
| 373 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); | 373 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 static bool initialized = false; | 517 static bool initialized = false; |
| 518 if (!initialized) { | 518 if (!initialized) { |
| 519 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 519 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
| 520 for (int i = 0; i < kThrobberIconCount; ++i) { | 520 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 521 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); | 521 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); |
| 522 DCHECK(throbber_icons_[i]); | 522 DCHECK(throbber_icons_[i]); |
| 523 } | 523 } |
| 524 initialized = true; | 524 initialized = true; |
| 525 } | 525 } |
| 526 } | 526 } |
| OLD | NEW |