| 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/bookmark_table_view.h" | 5 #include "chrome/browser/views/bookmark_table_view.h" |
| 6 | 6 |
| 7 #include "base/base_drag_source.h" | 7 #include "base/base_drag_source.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_utils.h" | 8 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_table_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_table_model.h" |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 if (alt_text_.empty()) | 424 if (alt_text_.empty()) |
| 425 return; | 425 return; |
| 426 | 426 |
| 427 HDC dc = GetDC(GetNativeControlHWND()); | 427 HDC dc = GetDC(GetNativeControlHWND()); |
| 428 ChromeFont font = GetAltTextFont(); | 428 ChromeFont font = GetAltTextFont(); |
| 429 gfx::Rect bounds = GetAltTextBounds(); | 429 gfx::Rect bounds = GetAltTextBounds(); |
| 430 ChromeCanvas canvas(bounds.width(), bounds.height(), false); | 430 ChromeCanvas canvas(bounds.width(), bounds.height(), false); |
| 431 // Pad by 1 for halo. | 431 // Pad by 1 for halo. |
| 432 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, | 432 canvas.DrawStringWithHalo(alt_text_, font, SK_ColorDKGRAY, SK_ColorWHITE, 1, |
| 433 1, bounds.width() - 2, bounds.height() - 2, | 433 1, bounds.width() - 2, bounds.height() - 2, |
| 434 ChromeCanvas::TEXT_ALIGN_LEFT); | 434 l10n_util::DefaultCanvasTextAlignment()); |
| 435 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); | 435 canvas.getTopPlatformDevice().drawToHDC(dc, bounds.x(), bounds.y(), NULL); |
| 436 ReleaseDC(GetNativeControlHWND(), dc); | 436 ReleaseDC(GetNativeControlHWND(), dc); |
| 437 } | 437 } |
| 438 | 438 |
| 439 gfx::Rect BookmarkTableView::GetAltTextBounds() { | 439 gfx::Rect BookmarkTableView::GetAltTextBounds() { |
| 440 static const int kXOffset = 16; | 440 static const int kXOffset = 16; |
| 441 DCHECK(GetNativeControlHWND()); | 441 DCHECK(GetNativeControlHWND()); |
| 442 CRect client_rect; | 442 CRect client_rect; |
| 443 GetClientRect(GetNativeControlHWND(), client_rect); | 443 GetClientRect(GetNativeControlHWND(), client_rect); |
| 444 ChromeFont font = GetAltTextFont(); | 444 ChromeFont font = GetAltTextFont(); |
| 445 // Pad height by 2 for halo. | 445 // Pad height by 2 for halo. |
| 446 return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, | 446 return gfx::Rect(kXOffset, content_offset(), client_rect.Width() - kXOffset, |
| 447 std::max(kImageSize, font.height() + 2)); | 447 std::max(kImageSize, font.height() + 2)); |
| 448 } | 448 } |
| 449 | 449 |
| 450 ChromeFont BookmarkTableView::GetAltTextFont() { | 450 ChromeFont BookmarkTableView::GetAltTextFont() { |
| 451 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); | 451 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); |
| 452 } | 452 } |
| OLD | NEW |