OLD | NEW |
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = UTF16ToWideHack(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::GetString(IDS_TAB_UNTITLED_TITLE); |
446 | 446 |
447 #if defined(OS_MACOSX) || defined(LINUX2) | 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::GetStringF(string_id, title); |
457 #endif | 457 #endif |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 UserMetrics::RecordAction(L"AboutChrome", profile_); | 1155 UserMetrics::RecordAction(L"AboutChrome", profile_); |
1156 window_->ShowAboutChromeDialog(); | 1156 window_->ShowAboutChromeDialog(); |
1157 } | 1157 } |
1158 | 1158 |
1159 void Browser::OpenHelpTab() { | 1159 void Browser::OpenHelpTab() { |
1160 GURL help_url(WideToASCII(l10n_util::GetString(IDS_HELP_CONTENT_URL))); | 1160 GURL help_url(WideToASCII(l10n_util::GetString(IDS_HELP_CONTENT_URL))); |
1161 AddTabWithURL(help_url, GURL(), PageTransition::AUTO_BOOKMARK, true, -1, | 1161 AddTabWithURL(help_url, GURL(), PageTransition::AUTO_BOOKMARK, true, -1, |
1162 false, NULL); | 1162 false, NULL); |
1163 } | 1163 } |
1164 | 1164 |
1165 #if defined(LINUX2) | 1165 #if defined(OS_CHROMEOS) |
1166 void Browser::ShowControlPanel() { | 1166 void Browser::ShowControlPanel() { |
1167 GURL url("http://localhost:8080"); | 1167 GURL url("http://localhost:8080"); |
1168 AddTabWithURL(url, GURL(), PageTransition::AUTO_BOOKMARK, true, -1, | 1168 AddTabWithURL(url, GURL(), PageTransition::AUTO_BOOKMARK, true, -1, |
1169 false, NULL); | 1169 false, NULL); |
1170 } | 1170 } |
1171 #endif | 1171 #endif |
1172 | 1172 |
1173 /////////////////////////////////////////////////////////////////////////////// | 1173 /////////////////////////////////////////////////////////////////////////////// |
1174 | 1174 |
1175 // static | 1175 // static |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 Personalization::HandleMenuItemClick(profile()); break; | 1374 Personalization::HandleMenuItemClick(profile()); break; |
1375 #endif | 1375 #endif |
1376 #endif | 1376 #endif |
1377 case IDC_OPTIONS: OpenOptionsDialog(); break; | 1377 case IDC_OPTIONS: OpenOptionsDialog(); break; |
1378 case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; | 1378 case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; |
1379 case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break; | 1379 case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break; |
1380 case IDC_CLEAR_BROWSING_DATA: OpenClearBrowsingDataDialog(); break; | 1380 case IDC_CLEAR_BROWSING_DATA: OpenClearBrowsingDataDialog(); break; |
1381 case IDC_IMPORT_SETTINGS: OpenImportSettingsDialog(); break; | 1381 case IDC_IMPORT_SETTINGS: OpenImportSettingsDialog(); break; |
1382 case IDC_ABOUT: OpenAboutChromeDialog(); break; | 1382 case IDC_ABOUT: OpenAboutChromeDialog(); break; |
1383 case IDC_HELP_PAGE: OpenHelpTab(); break; | 1383 case IDC_HELP_PAGE: OpenHelpTab(); break; |
1384 #if defined(LINUX2) | 1384 #if defined(OS_CHROMEOS) |
1385 case IDC_CONTROL_PANEL: ShowControlPanel(); break; | 1385 case IDC_CONTROL_PANEL: ShowControlPanel(); break; |
1386 #endif | 1386 #endif |
1387 | 1387 |
1388 default: | 1388 default: |
1389 LOG(WARNING) << "Received Unimplemented Command: " << id; | 1389 LOG(WARNING) << "Received Unimplemented Command: " << id; |
1390 break; | 1390 break; |
1391 } | 1391 } |
1392 } | 1392 } |
1393 | 1393 |
1394 /////////////////////////////////////////////////////////////////////////////// | 1394 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2126 // Show various bits of UI | 2126 // Show various bits of UI |
2127 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true); | 2127 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true); |
2128 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); | 2128 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); |
2129 command_updater_.UpdateCommandEnabled(IDC_JS_CONSOLE, true); | 2129 command_updater_.UpdateCommandEnabled(IDC_JS_CONSOLE, true); |
2130 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); | 2130 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); |
2131 command_updater_.UpdateCommandEnabled(IDC_SELECT_PROFILE, true); | 2131 command_updater_.UpdateCommandEnabled(IDC_SELECT_PROFILE, true); |
2132 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 2132 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
2133 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); | 2133 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); |
2134 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 2134 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
2135 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); | 2135 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); |
2136 #if defined(LINUX2) | 2136 #if defined(OS_CHROMEOS) |
2137 command_updater_.UpdateCommandEnabled(IDC_CONTROL_PANEL, true); | 2137 command_updater_.UpdateCommandEnabled(IDC_CONTROL_PANEL, true); |
2138 #endif | 2138 #endif |
2139 | 2139 |
2140 // Initialize other commands based on the window type. | 2140 // Initialize other commands based on the window type. |
2141 { | 2141 { |
2142 bool normal_window = type() == TYPE_NORMAL; | 2142 bool normal_window = type() == TYPE_NORMAL; |
2143 | 2143 |
2144 // Navigation commands | 2144 // Navigation commands |
2145 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); | 2145 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); |
2146 | 2146 |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ? ¤t_tab->controller() : NULL; | 2750 return current_tab ? ¤t_tab->controller() : NULL; |
2751 } | 2751 } |
OLD | NEW |