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

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

Issue 62167: Distributor logo and " - App Name" shouldn't be shown on app frame windows.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/views/frame/browser_view.h » ('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 "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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 // |contents| can be NULL because GetCurrentPageTitle is called by the window 408 // |contents| can be NULL because GetCurrentPageTitle is called by the window
409 // during the window's creation (before tabs have been added). 409 // during the window's creation (before tabs have been added).
410 if (contents) { 410 if (contents) {
411 title = UTF16ToWideHack(contents->GetTitle()); 411 title = UTF16ToWideHack(contents->GetTitle());
412 FormatTitleForDisplay(&title); 412 FormatTitleForDisplay(&title);
413 } 413 }
414 if (title.empty()) 414 if (title.empty())
415 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); 415 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
416 416
417 return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); 417 int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT;
418 // Don't append the app name to window titles when we're not displaying a
419 // distributor logo for the frame.
420 if (!ShouldShowDistributorLogo())
421 string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO;
422 return l10n_util::GetStringF(string_id, title);
418 } 423 }
419 424
420 // static 425 // static
421 void Browser::FormatTitleForDisplay(std::wstring* title) { 426 void Browser::FormatTitleForDisplay(std::wstring* title) {
422 size_t current_index = 0; 427 size_t current_index = 0;
423 size_t match_index; 428 size_t match_index;
424 while ((match_index = title->find(L'\n', current_index)) != 429 while ((match_index = title->find(L'\n', current_index)) !=
425 std::wstring::npos) { 430 std::wstring::npos) {
426 title->replace(match_index, 1, L""); 431 title->replace(match_index, 1, L"");
427 current_index = match_index; 432 current_index = match_index;
428 } 433 }
429 } 434 }
430 435
436 bool Browser::ShouldShowDistributorLogo() const {
437 // Don't show the distributor logo on app frames and app popups.
438 return !(type_ & TYPE_APP);
439 }
431 440
432 /////////////////////////////////////////////////////////////////////////////// 441 ///////////////////////////////////////////////////////////////////////////////
433 // Browser, OnBeforeUnload handling: 442 // Browser, OnBeforeUnload handling:
434 443
435 bool Browser::ShouldCloseWindow() { 444 bool Browser::ShouldCloseWindow() {
436 if (HasCompletedUnloadProcessing()) { 445 if (HasCompletedUnloadProcessing()) {
437 return true; 446 return true;
438 } 447 }
439 is_attempting_to_close_browser_ = true; 448 is_attempting_to_close_browser_ = true;
440 449
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 2573
2565 // We need to register the window position pref. 2574 // We need to register the window position pref.
2566 std::wstring window_pref(prefs::kBrowserWindowPlacement); 2575 std::wstring window_pref(prefs::kBrowserWindowPlacement);
2567 window_pref.append(L"_"); 2576 window_pref.append(L"_");
2568 window_pref.append(app_name); 2577 window_pref.append(app_name);
2569 PrefService* prefs = g_browser_process->local_state(); 2578 PrefService* prefs = g_browser_process->local_state();
2570 DCHECK(prefs); 2579 DCHECK(prefs);
2571 2580
2572 prefs->RegisterDictionaryPref(window_pref.c_str()); 2581 prefs->RegisterDictionaryPref(window_pref.c_str());
2573 } 2582 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.h ('k') | chrome/browser/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698