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

Side by Side Diff: chrome/browser/views/tabs/tab_renderer.cc

Issue 155334: Convert some stuff to string16 so the toolkit_views build can build again (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « chrome/browser/views/tabs/tab_renderer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tabs/tab_renderer.h" 5 #include "chrome/browser/views/tabs/tab_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "app/gfx/canvas.h" 9 #include "app/gfx/canvas.h"
10 #include "app/gfx/font.h" 10 #include "app/gfx/font.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return theme_provider_; 269 return theme_provider_;
270 270
271 // return contents->profile()->GetThemeProvider(); 271 // return contents->profile()->GetThemeProvider();
272 NOTREACHED() << "Unable to find a theme provider"; 272 NOTREACHED() << "Unable to find a theme provider";
273 return NULL; 273 return NULL;
274 } 274 }
275 275
276 void TabRenderer::UpdateData(TabContents* contents, bool loading_only) { 276 void TabRenderer::UpdateData(TabContents* contents, bool loading_only) {
277 DCHECK(contents); 277 DCHECK(contents);
278 if (!loading_only) { 278 if (!loading_only) {
279 data_.title = UTF16ToWideHack(contents->GetTitle()); 279 data_.title = contents->GetTitle();
280 data_.off_the_record = contents->profile()->IsOffTheRecord(); 280 data_.off_the_record = contents->profile()->IsOffTheRecord();
281 data_.crashed = contents->is_crashed(); 281 data_.crashed = contents->is_crashed();
282 data_.favicon = contents->GetFavIcon(); 282 data_.favicon = contents->GetFavIcon();
283 } 283 }
284 284
285 // TODO(glen): Temporary hax. 285 // TODO(glen): Temporary hax.
286 theme_provider_ = contents->profile()->GetThemeProvider(); 286 theme_provider_ = contents->profile()->GetThemeProvider();
287 287
288 // Loading state also involves whether we show the favicon, since that's where 288 // Loading state also involves whether we show the favicon, since that's where
289 // we display the throbber. 289 // we display the throbber.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 gfx::Size standard_size = GetMinimumUnselectedSize(); 370 gfx::Size standard_size = GetMinimumUnselectedSize();
371 standard_size.set_width( 371 standard_size.set_width(
372 standard_size.width() + kFavIconTitleSpacing + kStandardTitleWidth); 372 standard_size.width() + kFavIconTitleSpacing + kStandardTitleWidth);
373 return standard_size; 373 return standard_size;
374 } 374 }
375 375
376 //////////////////////////////////////////////////////////////////////////////// 376 ////////////////////////////////////////////////////////////////////////////////
377 // TabRenderer, protected: 377 // TabRenderer, protected:
378 378
379 std::wstring TabRenderer::GetTitle() const { 379 std::wstring TabRenderer::GetTitle() const {
380 return data_.title; 380 return UTF16ToWideHack(data_.title);
381 } 381 }
382 382
383 //////////////////////////////////////////////////////////////////////////////// 383 ////////////////////////////////////////////////////////////////////////////////
384 // TabRenderer, views::View overrides: 384 // TabRenderer, views::View overrides:
385 385
386 void TabRenderer::Paint(gfx::Canvas* canvas) { 386 void TabRenderer::Paint(gfx::Canvas* canvas) {
387 // Don't paint if we're narrower than we can render correctly. (This should 387 // Don't paint if we're narrower than we can render correctly. (This should
388 // only happen during animations). 388 // only happen during animations).
389 if (width() < GetMinimumUnselectedSize().width()) 389 if (width() < GetMinimumUnselectedSize().width())
390 return; 390 return;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 favicon_bounds_.y() + fav_icon_hiding_offset_, 425 favicon_bounds_.y() + fav_icon_hiding_offset_,
426 kFaviconSize, kFaviconSize, 426 kFaviconSize, kFaviconSize,
427 true); 427 true);
428 } 428 }
429 } 429 }
430 canvas->restore(); 430 canvas->restore();
431 } 431 }
432 } 432 }
433 433
434 // Paint the Title. 434 // Paint the Title.
435 std::wstring title = data_.title; 435 string16 title = data_.title;
436 if (title.empty()) { 436 if (title.empty()) {
437 if (data_.loading) { 437 if (data_.loading) {
438 title = l10n_util::GetString(IDS_TAB_LOADING_TITLE); 438 title = l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE);
439 } else { 439 } else {
440 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); 440 title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE);
441 } 441 }
442 } else { 442 } else {
443 Browser::FormatTitleForDisplay(&title); 443 Browser::FormatTitleForDisplay(&title);
444 } 444 }
445 445
446 SkColor title_color = GetThemeProvider()-> 446 SkColor title_color = GetThemeProvider()->
447 GetColor(IsSelected() ? 447 GetColor(IsSelected() ?
448 BrowserThemeProvider::COLOR_TAB_TEXT : 448 BrowserThemeProvider::COLOR_TAB_TEXT :
449 BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT); 449 BrowserThemeProvider::COLOR_BACKGROUND_TAB_TEXT);
450 450
451 canvas->DrawStringInt(title, *title_font, title_color, title_bounds_.x(), 451 canvas->DrawStringInt(UTF16ToWideHack(title), *title_font, title_color,
452 title_bounds_.y(), title_bounds_.width(), 452 title_bounds_.x(), title_bounds_.y(),
453 title_bounds_.height()); 453 title_bounds_.width(), title_bounds_.height());
454 } 454 }
455 455
456 void TabRenderer::Layout() { 456 void TabRenderer::Layout() {
457 gfx::Rect lb = GetLocalBounds(false); 457 gfx::Rect lb = GetLocalBounds(false);
458 if (lb.IsEmpty()) 458 if (lb.IsEmpty())
459 return; 459 return;
460 lb.Inset(kLeftPadding, kTopPadding, kRightPadding, kBottomPadding); 460 lb.Inset(kLeftPadding, kTopPadding, kRightPadding, kBottomPadding);
461 461
462 // First of all, figure out who is tallest. 462 // First of all, figure out who is tallest.
463 int content_height = GetContentHeight(); 463 int content_height = GetContentHeight();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); 789 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
790 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); 790 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
791 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); 791 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
792 792
793 tab_inactive.l_width = tab_inactive.image_l->width(); 793 tab_inactive.l_width = tab_inactive.image_l->width();
794 tab_inactive.r_width = tab_inactive.image_r->width(); 794 tab_inactive.r_width = tab_inactive.image_r->width();
795 795
796 loading_animation_frames = rb.GetBitmapNamed(IDR_THROBBER); 796 loading_animation_frames = rb.GetBitmapNamed(IDR_THROBBER);
797 waiting_animation_frames = rb.GetBitmapNamed(IDR_THROBBER_WAITING); 797 waiting_animation_frames = rb.GetBitmapNamed(IDR_THROBBER_WAITING);
798 } 798 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698