OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 void Browser::ShowDownloadsTab() { | 1717 void Browser::ShowDownloadsTab() { |
1718 UserMetrics::RecordAction(UserMetricsAction("ShowDownloads"), profile_); | 1718 UserMetrics::RecordAction(UserMetricsAction("ShowDownloads"), profile_); |
1719 ShowSingletonTab(GURL(chrome::kChromeUIDownloadsURL)); | 1719 ShowSingletonTab(GURL(chrome::kChromeUIDownloadsURL)); |
1720 } | 1720 } |
1721 | 1721 |
1722 void Browser::ShowExtensionsTab() { | 1722 void Browser::ShowExtensionsTab() { |
1723 UserMetrics::RecordAction(UserMetricsAction("ShowExtensions"), profile_); | 1723 UserMetrics::RecordAction(UserMetricsAction("ShowExtensions"), profile_); |
1724 ShowSingletonTab(GURL(chrome::kChromeUIExtensionsURL)); | 1724 ShowSingletonTab(GURL(chrome::kChromeUIExtensionsURL)); |
1725 } | 1725 } |
1726 | 1726 |
| 1727 void Browser::ShowAboutConflictsTab() { |
| 1728 UserMetrics::RecordAction(UserMetricsAction("AboutConflicts"), profile_); |
| 1729 ShowSingletonTab(GURL(chrome::kChromeUIConflictsURL)); |
| 1730 } |
| 1731 |
1727 void Browser::ShowBrokenPageTab(TabContents* contents) { | 1732 void Browser::ShowBrokenPageTab(TabContents* contents) { |
1728 UserMetrics::RecordAction(UserMetricsAction("ReportBug"), profile_); | 1733 UserMetrics::RecordAction(UserMetricsAction("ReportBug"), profile_); |
1729 string16 page_title = contents->GetTitle(); | 1734 string16 page_title = contents->GetTitle(); |
1730 NavigationEntry* entry = contents->controller().GetActiveEntry(); | 1735 NavigationEntry* entry = contents->controller().GetActiveEntry(); |
1731 if (!entry) | 1736 if (!entry) |
1732 return; | 1737 return; |
1733 std::string page_url = entry->url().spec(); | 1738 std::string page_url = entry->url().spec(); |
1734 std::vector<std::string> subst; | 1739 std::vector<std::string> subst; |
1735 subst.push_back(UTF16ToASCII(page_title)); | 1740 subst.push_back(UTF16ToASCII(page_title)); |
1736 subst.push_back(page_url); | 1741 subst.push_back(page_url); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2193 #if defined(ENABLE_REMOTING) | 2198 #if defined(ENABLE_REMOTING) |
2194 case IDC_REMOTING_SETUP: OpenRemotingSetupDialog(); break; | 2199 case IDC_REMOTING_SETUP: OpenRemotingSetupDialog(); break; |
2195 #endif | 2200 #endif |
2196 case IDC_OPTIONS: OpenOptionsDialog(); break; | 2201 case IDC_OPTIONS: OpenOptionsDialog(); break; |
2197 case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; | 2202 case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; |
2198 case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break; | 2203 case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break; |
2199 case IDC_CLEAR_BROWSING_DATA: OpenClearBrowsingDataDialog(); break; | 2204 case IDC_CLEAR_BROWSING_DATA: OpenClearBrowsingDataDialog(); break; |
2200 case IDC_IMPORT_SETTINGS: OpenImportSettingsDialog(); break; | 2205 case IDC_IMPORT_SETTINGS: OpenImportSettingsDialog(); break; |
2201 case IDC_ABOUT: OpenAboutChromeDialog(); break; | 2206 case IDC_ABOUT: OpenAboutChromeDialog(); break; |
2202 case IDC_UPGRADE_DIALOG: OpenUpdateChromeDialog(); break; | 2207 case IDC_UPGRADE_DIALOG: OpenUpdateChromeDialog(); break; |
| 2208 case IDC_VIEW_INCOMPATIBILITIES: ShowAboutConflictsTab(); break; |
2203 case IDC_HELP_PAGE: OpenHelpTab(); break; | 2209 case IDC_HELP_PAGE: OpenHelpTab(); break; |
2204 #if defined(OS_CHROMEOS) | 2210 #if defined(OS_CHROMEOS) |
2205 case IDC_SYSTEM_OPTIONS: OpenSystemOptionsDialog(); break; | 2211 case IDC_SYSTEM_OPTIONS: OpenSystemOptionsDialog(); break; |
2206 case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break; | 2212 case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break; |
2207 case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break; | 2213 case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break; |
2208 #endif | 2214 #endif |
2209 | 2215 |
2210 default: | 2216 default: |
2211 LOG(WARNING) << "Received Unimplemented Command: " << id; | 2217 LOG(WARNING) << "Received Unimplemented Command: " << id; |
2212 break; | 2218 break; |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 | 3068 |
3063 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 3069 void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
3064 window()->HandleKeyboardEvent(event); | 3070 window()->HandleKeyboardEvent(event); |
3065 } | 3071 } |
3066 | 3072 |
3067 void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { | 3073 void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { |
3068 window()->ShowRepostFormWarningDialog(tab_contents); | 3074 window()->ShowRepostFormWarningDialog(tab_contents); |
3069 } | 3075 } |
3070 | 3076 |
3071 void Browser::ShowContentSettingsWindow(ContentSettingsType content_type) { | 3077 void Browser::ShowContentSettingsWindow(ContentSettingsType content_type) { |
3072 | |
3073 if (CommandLine::ForCurrentProcess()->HasSwitch( | 3078 if (CommandLine::ForCurrentProcess()->HasSwitch( |
3074 switches::kEnableTabbedOptions)) { | 3079 switches::kEnableTabbedOptions)) { |
3075 ShowOptionsTab( | 3080 ShowOptionsTab( |
3076 chrome::kContentSettingsSubPage + kHashMark + | 3081 chrome::kContentSettingsSubPage + kHashMark + |
3077 ContentSettingsHandler::ContentSettingsTypeToGroupName(content_type)); | 3082 ContentSettingsHandler::ContentSettingsTypeToGroupName(content_type)); |
3078 } else { | 3083 } else { |
3079 window()->ShowContentSettingsWindow(content_type, | 3084 window()->ShowContentSettingsWindow(content_type, |
3080 profile_->GetOriginalProfile()); | 3085 profile_->GetOriginalProfile()); |
3081 } | 3086 } |
3082 } | 3087 } |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, non_devtools_window); | 3480 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, non_devtools_window); |
3476 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, non_devtools_window); | 3481 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, non_devtools_window); |
3477 | 3482 |
3478 // AutoFill | 3483 // AutoFill |
3479 command_updater_.UpdateCommandEnabled(IDC_AUTOFILL_DEFAULT, | 3484 command_updater_.UpdateCommandEnabled(IDC_AUTOFILL_DEFAULT, |
3480 non_devtools_window); | 3485 non_devtools_window); |
3481 | 3486 |
3482 // Show various bits of UI | 3487 // Show various bits of UI |
3483 command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, normal_window); | 3488 command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, normal_window); |
3484 | 3489 |
3485 // The upgrade entry should always be enabled. Whether it is visible is a | 3490 // The upgrade entry and the view incompatibility entry should always be |
3486 // separate matter determined on menu show. | 3491 // enabled. Whether they are visible is a separate matter determined on menu |
| 3492 // show. |
3487 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); | 3493 command_updater_.UpdateCommandEnabled(IDC_UPGRADE_DIALOG, true); |
| 3494 command_updater_.UpdateCommandEnabled(IDC_VIEW_INCOMPATIBILITIES, true); |
3488 | 3495 |
3489 // Initialize other commands whose state changes based on fullscreen mode. | 3496 // Initialize other commands whose state changes based on fullscreen mode. |
3490 UpdateCommandsForFullscreenMode(false); | 3497 UpdateCommandsForFullscreenMode(false); |
3491 | 3498 |
3492 UpdateCommandsForContentRestrictionState(); | 3499 UpdateCommandsForContentRestrictionState(); |
3493 } | 3500 } |
3494 | 3501 |
3495 void Browser::UpdateCommandsForTabState() { | 3502 void Browser::UpdateCommandsForTabState() { |
3496 TabContents* current_tab = GetSelectedTabContents(); | 3503 TabContents* current_tab = GetSelectedTabContents(); |
3497 if (!current_tab) // May be NULL during tab restore. | 3504 if (!current_tab) // May be NULL during tab restore. |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4067 NOTREACHED(); | 4074 NOTREACHED(); |
4068 return false; | 4075 return false; |
4069 } | 4076 } |
4070 | 4077 |
4071 void Browser::CreateInstantIfNecessary() { | 4078 void Browser::CreateInstantIfNecessary() { |
4072 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4079 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && |
4073 !profile()->IsOffTheRecord()) { | 4080 !profile()->IsOffTheRecord()) { |
4074 instant_.reset(new InstantController(profile_, this)); | 4081 instant_.reset(new InstantController(profile_, this)); |
4075 } | 4082 } |
4076 } | 4083 } |
OLD | NEW |