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

Side by Side Diff: chrome/browser/browser.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/browser.h ('k') | chrome/browser/gtk/browser_window_gtk.cc » ('j') | 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-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/idle_timer.h" 10 #include "base/idle_timer.h"
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 return maximized; 424 return maximized;
425 } 425 }
426 426
427 SkBitmap Browser::GetCurrentPageIcon() const { 427 SkBitmap Browser::GetCurrentPageIcon() const {
428 TabContents* contents = GetSelectedTabContents(); 428 TabContents* contents = GetSelectedTabContents();
429 // |contents| can be NULL since GetCurrentPageIcon() is called by the window 429 // |contents| can be NULL since GetCurrentPageIcon() is called by the window
430 // during the window's creation (before tabs have been added). 430 // during the window's creation (before tabs have been added).
431 return contents ? contents->GetFavIcon() : SkBitmap(); 431 return contents ? contents->GetFavIcon() : SkBitmap();
432 } 432 }
433 433
434 std::wstring Browser::GetCurrentPageTitle() const { 434 string16 Browser::GetCurrentPageTitle() const {
435 TabContents* contents = tabstrip_model_.GetSelectedTabContents(); 435 TabContents* contents = tabstrip_model_.GetSelectedTabContents();
436 std::wstring title; 436 string16 title;
437 437
438 // |contents| can be NULL because GetCurrentPageTitle is called by the window 438 // |contents| can be NULL because GetCurrentPageTitle is called by the window
439 // during the window's creation (before tabs have been added). 439 // during the window's creation (before tabs have been added).
440 if (contents) { 440 if (contents) {
441 title = UTF16ToWideHack(contents->GetTitle()); 441 title = contents->GetTitle();
442 FormatTitleForDisplay(&title); 442 FormatTitleForDisplay(&title);
443 } 443 }
444 if (title.empty()) 444 if (title.empty())
445 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); 445 title = l10n_util::GetStringUTF16(IDS_TAB_UNTITLED_TITLE);
446 446
447 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) 447 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
448 // On Mac, we don't want to suffix the page title with the application name. 448 // On Mac, we don't want to suffix the page title with the application name.
449 return title; 449 return title;
450 #elif defined(OS_WIN) || defined(OS_LINUX) 450 #elif defined(OS_WIN) || defined(OS_LINUX)
451 int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT; 451 int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT;
452 // Don't append the app name to window titles when we're not displaying a 452 // Don't append the app name to window titles when we're not displaying a
453 // distributor logo for the frame. 453 // distributor logo for the frame.
454 if (!ShouldShowDistributorLogo()) 454 if (!ShouldShowDistributorLogo())
455 string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO; 455 string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO;
456 return l10n_util::GetStringF(string_id, title); 456 return l10n_util::GetStringFUTF16(string_id, title);
457 #endif 457 #endif
458 } 458 }
459 459
460 // static 460 // static
461 void Browser::FormatTitleForDisplay(std::wstring* title) { 461 void Browser::FormatTitleForDisplay(string16* title) {
462 size_t current_index = 0; 462 size_t current_index = 0;
463 size_t match_index; 463 size_t match_index;
464 while ((match_index = title->find(L'\n', current_index)) != 464 while ((match_index = title->find(L'\n', current_index)) !=
465 std::wstring::npos) { 465 std::wstring::npos) {
466 title->replace(match_index, 1, L""); 466 title->replace(match_index, 1, EmptyString16());
467 current_index = match_index; 467 current_index = match_index;
468 } 468 }
469 } 469 }
470 470
471 bool Browser::ShouldShowDistributorLogo() const { 471 bool Browser::ShouldShowDistributorLogo() const {
472 // Don't show the distributor logo on app frames and app popups. 472 // Don't show the distributor logo on app frames and app popups.
473 return !(type_ & TYPE_APP); 473 return !(type_ & TYPE_APP);
474 } 474 }
475 475
476 /////////////////////////////////////////////////////////////////////////////// 476 ///////////////////////////////////////////////////////////////////////////////
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 /////////////////////////////////////////////////////////////////////////////// 2742 ///////////////////////////////////////////////////////////////////////////////
2743 // BrowserToolbarModel (private): 2743 // BrowserToolbarModel (private):
2744 2744
2745 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 2745 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
2746 // This |current_tab| can be NULL during the initialization of the 2746 // This |current_tab| can be NULL during the initialization of the
2747 // toolbar during window creation (i.e. before any tabs have been added 2747 // toolbar during window creation (i.e. before any tabs have been added
2748 // to the window). 2748 // to the window).
2749 TabContents* current_tab = browser_->GetSelectedTabContents(); 2749 TabContents* current_tab = browser_->GetSelectedTabContents();
2750 return current_tab ? &current_tab->controller() : NULL; 2750 return current_tab ? &current_tab->controller() : NULL;
2751 } 2751 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/gtk/browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698