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

Side by Side Diff: chrome/browser/browser.cc

Issue 39022: Convert NavigationEntry title to string16. TabContents::GetTitle no longer ne... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « base/string_util.cc ('k') | chrome/browser/debugger/debugger_host_impl.cpp » ('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-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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/idle_timer.h" 8 #include "base/idle_timer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 std::wstring Browser::GetCurrentPageTitle() const { 394 std::wstring Browser::GetCurrentPageTitle() const {
395 #if defined(OS_WIN) 395 #if defined(OS_WIN)
396 TabContents* contents = tabstrip_model_.GetSelectedTabContents(); 396 TabContents* contents = tabstrip_model_.GetSelectedTabContents();
397 std::wstring title; 397 std::wstring title;
398 398
399 // |contents| can be NULL because GetCurrentPageTitle is called by the window 399 // |contents| can be NULL because GetCurrentPageTitle is called by the window
400 // during the window's creation (before tabs have been added). 400 // during the window's creation (before tabs have been added).
401 if (contents) { 401 if (contents) {
402 title = contents->GetTitle(); 402 title = UTF16ToWideHack(contents->GetTitle());
403 FormatTitleForDisplay(&title); 403 FormatTitleForDisplay(&title);
404 } 404 }
405 if (title.empty()) 405 if (title.empty())
406 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); 406 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
407 407
408 return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); 408 return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, title);
409 #elif defined(OS_POSIX) 409 #elif defined(OS_POSIX)
410 // TODO(port): turn on when generating chrome_strings.h from grit 410 // TODO(port): turn on when generating chrome_strings.h from grit
411 return L"untitled"; 411 return L"untitled";
412 #endif 412 #endif
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 if (!model || !model->IsLoaded()) 731 if (!model || !model->IsLoaded())
732 return; // Ignore requests until bookmarks are loaded. 732 return; // Ignore requests until bookmarks are loaded.
733 733
734 NavigationEntry* entry = contents->controller()->GetActiveEntry(); 734 NavigationEntry* entry = contents->controller()->GetActiveEntry();
735 if (!entry) 735 if (!entry)
736 return; // Can't star if there is no URL. 736 return; // Can't star if there is no URL.
737 const GURL& url = entry->display_url(); 737 const GURL& url = entry->display_url();
738 if (url.is_empty() || !url.is_valid()) 738 if (url.is_empty() || !url.is_valid())
739 return; 739 return;
740 740
741 model->SetURLStarred(url, UTF16ToWideHack(entry->title()), true);
741 bool was_bookmarked = model->IsBookmarked(url); 742 bool was_bookmarked = model->IsBookmarked(url);
742 model->SetURLStarred(url, entry->title(), true); 743 model->SetURLStarred(url, UTF16ToWideHack(entry->title()), true);
743 if (window_->IsActive()) { 744 if (window_->IsActive()) {
744 // Only show the bubble if the window is active, otherwise we may get into 745 // Only show the bubble if the window is active, otherwise we may get into
745 // weird situations were the bubble is deleted as soon as it is shown. 746 // weird situations were the bubble is deleted as soon as it is shown.
746 window_->ShowBookmarkBubble(url, was_bookmarked); 747 window_->ShowBookmarkBubble(url, was_bookmarked);
747 } 748 }
748 } 749 }
749 750
750 void Browser::SavePage() { 751 void Browser::SavePage() {
751 UserMetrics::RecordAction(L"SavePage", profile_); 752 UserMetrics::RecordAction(L"SavePage", profile_);
752 GetSelectedTabContents()->AsWebContents()->OnSavePage(); 753 GetSelectedTabContents()->AsWebContents()->OnSavePage();
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 2455
2455 // We need to register the window position pref. 2456 // We need to register the window position pref.
2456 std::wstring window_pref(prefs::kBrowserWindowPlacement); 2457 std::wstring window_pref(prefs::kBrowserWindowPlacement);
2457 window_pref.append(L"_"); 2458 window_pref.append(L"_");
2458 window_pref.append(app_name); 2459 window_pref.append(app_name);
2459 PrefService* prefs = g_browser_process->local_state(); 2460 PrefService* prefs = g_browser_process->local_state();
2460 DCHECK(prefs); 2461 DCHECK(prefs);
2461 2462
2462 prefs->RegisterDictionaryPref(window_pref.c_str()); 2463 prefs->RegisterDictionaryPref(window_pref.c_str());
2463 } 2464 }
OLDNEW
« no previous file with comments | « base/string_util.cc ('k') | chrome/browser/debugger/debugger_host_impl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698