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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 GURL url(chrome::kChromeUISettingsURL + sub_page); |
1989 browser::NavigateParams params(GetSingletonTabNavigateParams(url)); | 1990 browser::NavigateParams params(GetSingletonTabNavigateParams(url)); |
1990 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; | 1991 params.path_behavior = browser::NavigateParams::IGNORE_AND_NAVIGATE; |
1992 | |
1993 GURL ntp(chrome::kChromeUINewTabURL); | |
James Hawkins
2011/06/17 17:44:57
You only use |ntp| once, so just use the const var
Greg Billock
2011/06/17 21:16:07
Done.
| |
1994 GURL blank(chrome::kAboutBlankURL); | |
James Hawkins
2011/06/17 17:44:57
Same for blank.
Greg Billock
2011/06/17 21:16:07
Done.
| |
1995 if ((GetSelectedTabContents()->GetURL() == ntp || | |
1996 GetSelectedTabContents()->GetURL() == blank) && | |
1997 browser::GetIndexOfSingletonTab(¶ms) < 0) { | |
1998 params.disposition = CURRENT_TAB; | |
1999 } | |
2000 | |
1991 browser::Navigate(¶ms); | 2001 browser::Navigate(¶ms); |
1992 } | 2002 } |
1993 | 2003 |
1994 void Browser::OpenClearBrowsingDataDialog() { | 2004 void Browser::OpenClearBrowsingDataDialog() { |
1995 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg")); | 2005 UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg")); |
1996 ShowOptionsTab(chrome::kClearBrowserDataSubPage); | 2006 ShowOptionsTab(chrome::kClearBrowserDataSubPage); |
1997 } | 2007 } |
1998 | 2008 |
1999 void Browser::OpenOptionsDialog() { | 2009 void Browser::OpenOptionsDialog() { |
James Hawkins
2011/06/17 17:44:57
Wha?? Why do we have two methods for opening Optio
Greg Billock
2011/06/17 21:16:07
I can do that. I wasn't sure what all went in to t
| |
2000 UserMetrics::RecordAction(UserMetricsAction("ShowOptions")); | 2010 UserMetrics::RecordAction(UserMetricsAction("ShowOptions")); |
2001 GURL url(chrome::kChromeUISettingsURL); | 2011 GURL url(chrome::kChromeUISettingsURL); |
2002 browser::NavigateParams params(GetSingletonTabNavigateParams(url)); | 2012 browser::NavigateParams params(GetSingletonTabNavigateParams(url)); |
2003 params.path_behavior = browser::NavigateParams::IGNORE_AND_STAY_PUT; | 2013 params.path_behavior = browser::NavigateParams::IGNORE_AND_STAY_PUT; |
2014 | |
2015 GURL ntp(chrome::kChromeUINewTabURL); | |
2016 GURL blank(chrome::kAboutBlankURL); | |
2017 if ((GetSelectedTabContents()->GetURL() == ntp || | |
2018 GetSelectedTabContents()->GetURL() == blank) && | |
2019 browser::GetIndexOfSingletonTab(¶ms) < 0) { | |
2020 params.disposition = CURRENT_TAB; | |
2021 } | |
2022 | |
2004 browser::Navigate(¶ms); | 2023 browser::Navigate(¶ms); |
2005 } | 2024 } |
2006 | 2025 |
2007 void Browser::OpenPasswordManager() { | 2026 void Browser::OpenPasswordManager() { |
2008 UserMetrics::RecordAction(UserMetricsAction("Options_ShowPasswordManager")); | 2027 UserMetrics::RecordAction(UserMetricsAction("Options_ShowPasswordManager")); |
2009 ShowOptionsTab(chrome::kPasswordManagerSubPage); | 2028 ShowOptionsTab(chrome::kPasswordManagerSubPage); |
2010 } | 2029 } |
2011 | 2030 |
2012 void Browser::OpenImportSettingsDialog() { | 2031 void Browser::OpenImportSettingsDialog() { |
2013 UserMetrics::RecordAction(UserMetricsAction("Import_ShowDlg")); | 2032 UserMetrics::RecordAction(UserMetricsAction("Import_ShowDlg")); |
(...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4710 TabContents* current_tab = GetSelectedTabContents(); | 4729 TabContents* current_tab = GetSelectedTabContents(); |
4711 if (current_tab) { | 4730 if (current_tab) { |
4712 content_restrictions = current_tab->content_restrictions(); | 4731 content_restrictions = current_tab->content_restrictions(); |
4713 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4732 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
4714 // See comment in UpdateCommandsForTabState about why we call url(). | 4733 // See comment in UpdateCommandsForTabState about why we call url(). |
4715 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4734 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
4716 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4735 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
4717 } | 4736 } |
4718 return content_restrictions; | 4737 return content_restrictions; |
4719 } | 4738 } |
OLD | NEW |