OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser.h" | 5 #include "chrome/browser/ui/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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "chrome/browser/tab_closeable_state_watcher.h" | 71 #include "chrome/browser/tab_closeable_state_watcher.h" |
72 #include "chrome/browser/tab_contents/background_contents.h" | 72 #include "chrome/browser/tab_contents/background_contents.h" |
73 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 73 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
74 #include "chrome/browser/tabs/tab_finder.h" | 74 #include "chrome/browser/tabs/tab_finder.h" |
75 #include "chrome/browser/tabs/tab_strip_model.h" | 75 #include "chrome/browser/tabs/tab_strip_model.h" |
76 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 76 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
77 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 77 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
78 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 78 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
79 #include "chrome/browser/ui/browser_dialogs.h" | 79 #include "chrome/browser/ui/browser_dialogs.h" |
80 #include "chrome/browser/ui/browser_list.h" | 80 #include "chrome/browser/ui/browser_list.h" |
| 81 #include "chrome/browser/ui/browser_navigator.h" |
81 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 82 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
82 #include "chrome/browser/ui/browser_window.h" | 83 #include "chrome/browser/ui/browser_window.h" |
83 #include "chrome/browser/ui/download/download_tab_helper.h" | 84 #include "chrome/browser/ui/download/download_tab_helper.h" |
84 #include "chrome/browser/ui/find_bar/find_bar.h" | 85 #include "chrome/browser/ui/find_bar/find_bar.h" |
85 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 86 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
86 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 87 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
87 #include "chrome/browser/ui/omnibox/location_bar.h" | 88 #include "chrome/browser/ui/omnibox/location_bar.h" |
88 #include "chrome/browser/ui/panels/panel.h" | 89 #include "chrome/browser/ui/panels/panel.h" |
89 #include "chrome/browser/ui/panels/panel_manager.h" | 90 #include "chrome/browser/ui/panels/panel_manager.h" |
90 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 91 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 std::string page_url = entry->url().spec(); | 1979 std::string page_url = entry->url().spec(); |
1979 std::vector<std::string> subst; | 1980 std::vector<std::string> subst; |
1980 subst.push_back(UTF16ToASCII(page_title)); | 1981 subst.push_back(UTF16ToASCII(page_title)); |
1981 subst.push_back(page_url); | 1982 subst.push_back(page_url); |
1982 std::string report_page_url = | 1983 std::string report_page_url = |
1983 ReplaceStringPlaceholders(kBrokenPageUrl, subst, NULL); | 1984 ReplaceStringPlaceholders(kBrokenPageUrl, subst, NULL); |
1984 ShowSingletonTab(GURL(report_page_url)); | 1985 ShowSingletonTab(GURL(report_page_url)); |
1985 } | 1986 } |
1986 | 1987 |
1987 void Browser::ShowOptionsTab(const std::string& sub_page) { | 1988 void Browser::ShowOptionsTab(const std::string& sub_page) { |
1988 GURL url(chrome::kChromeUISettingsURL + sub_page); | 1989 browser::NavigateParams params(GetSingletonTabNavigateParams( |
1989 browser::NavigateParams params(GetSingletonTabNavigateParams(url)); | 1990 GURL(chrome::kChromeUISettingsURL + sub_page))); |
1990 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; | 1991 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
| 1992 |
| 1993 if ((GetSelectedTabContents()->GetURL() == GURL(chrome::kChromeUINewTabURL) || |
| 1994 GetSelectedTabContents()->GetURL() == GURL(chrome::kAboutBlankURL)) && |
| 1995 browser::GetIndexOfSingletonTab(¶ms) < 0) { |
| 1996 params.disposition = CURRENT_TAB; |
| 1997 } |
| 1998 |
1991 browser::Navigate(¶ms); | 1999 browser::Navigate(¶ms); |
1992 } | 2000 } |
1993 | 2001 |
1994 void Browser::OpenClearBrowsingDataDialog() { | 2002 void Browser::OpenClearBrowsingDataDialog() { |
1995 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg")); | 2003 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg")); |
1996 ShowOptionsTab(chrome::kClearBrowserDataSubPage); | 2004 ShowOptionsTab(chrome::kClearBrowserDataSubPage); |
1997 } | 2005 } |
1998 | 2006 |
1999 void Browser::OpenOptionsDialog() { | 2007 void Browser::OpenOptionsDialog() { |
2000 UserMetrics::RecordAction(UserMetricsAction("ShowOptions")); | 2008 UserMetrics::RecordAction(UserMetricsAction("ShowOptions")); |
2001 GURL url(chrome::kChromeUISettingsURL); | 2009 ShowOptionsTab(""); |
2002 browser::NavigateParams params(GetSingletonTabNavigateParams(url)); | |
2003 params.path_behavior = browser::NavigateParams::IGNORE_AND_STAY_PUT; | |
2004 browser::Navigate(¶ms); | |
2005 } | 2010 } |
2006 | 2011 |
2007 void Browser::OpenPasswordManager() { | 2012 void Browser::OpenPasswordManager() { |
2008 UserMetrics::RecordAction(UserMetricsAction("Options_ShowPasswordManager")); | 2013 UserMetrics::RecordAction(UserMetricsAction("Options_ShowPasswordManager")); |
2009 ShowOptionsTab(chrome::kPasswordManagerSubPage); | 2014 ShowOptionsTab(chrome::kPasswordManagerSubPage); |
2010 } | 2015 } |
2011 | 2016 |
2012 void Browser::OpenImportSettingsDialog() { | 2017 void Browser::OpenImportSettingsDialog() { |
2013 UserMetrics::RecordAction(UserMetricsAction("Import_ShowDlg")); | 2018 UserMetrics::RecordAction(UserMetricsAction("Import_ShowDlg")); |
2014 ShowOptionsTab(chrome::kImportDataSubPage); | 2019 ShowOptionsTab(chrome::kImportDataSubPage); |
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4710 TabContents* current_tab = GetSelectedTabContents(); | 4715 TabContents* current_tab = GetSelectedTabContents(); |
4711 if (current_tab) { | 4716 if (current_tab) { |
4712 content_restrictions = current_tab->content_restrictions(); | 4717 content_restrictions = current_tab->content_restrictions(); |
4713 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4718 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4714 // See comment in UpdateCommandsForTabState about why we call url(). | 4719 // See comment in UpdateCommandsForTabState about why we call url(). |
4715 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4720 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4716 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4721 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4717 } | 4722 } |
4718 return content_restrictions; | 4723 return content_restrictions; |
4719 } | 4724 } |
OLD | NEW |