| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "chrome/browser/download/download_service_factory.h" | 49 #include "chrome/browser/download/download_service_factory.h" |
| 50 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" | 50 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" |
| 51 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 51 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
| 52 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 52 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
| 53 #include "chrome/browser/extensions/extension_service.h" | 53 #include "chrome/browser/extensions/extension_service.h" |
| 54 #include "chrome/browser/extensions/extension_ui_util.h" | 54 #include "chrome/browser/extensions/extension_ui_util.h" |
| 55 #include "chrome/browser/extensions/extension_util.h" | 55 #include "chrome/browser/extensions/extension_util.h" |
| 56 #include "chrome/browser/extensions/tab_helper.h" | 56 #include "chrome/browser/extensions/tab_helper.h" |
| 57 #include "chrome/browser/file_select_helper.h" | 57 #include "chrome/browser/file_select_helper.h" |
| 58 #include "chrome/browser/first_run/first_run.h" | 58 #include "chrome/browser/first_run/first_run.h" |
| 59 #include "chrome/browser/history/top_sites_factory.h" | |
| 60 #include "chrome/browser/infobars/infobar_service.h" | 59 #include "chrome/browser/infobars/infobar_service.h" |
| 61 #include "chrome/browser/lifetime/application_lifetime.h" | 60 #include "chrome/browser/lifetime/application_lifetime.h" |
| 62 #include "chrome/browser/lifetime/keep_alive_registry.h" | 61 #include "chrome/browser/lifetime/keep_alive_registry.h" |
| 63 #include "chrome/browser/lifetime/keep_alive_types.h" | 62 #include "chrome/browser/lifetime/keep_alive_types.h" |
| 64 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 63 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 65 #include "chrome/browser/memory/tab_manager_web_contents_data.h" | 64 #include "chrome/browser/memory/tab_manager_web_contents_data.h" |
| 66 #include "chrome/browser/notifications/notification_ui_manager.h" | 65 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 67 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 66 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
| 68 #include "chrome/browser/permissions/permission_request_manager.h" | 67 #include "chrome/browser/permissions/permission_request_manager.h" |
| 69 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 68 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 #include "chrome/browser/ui/settings_window_manager.h" | 129 #include "chrome/browser/ui/settings_window_manager.h" |
| 131 #include "chrome/browser/ui/singleton_tabs.h" | 130 #include "chrome/browser/ui/singleton_tabs.h" |
| 132 #include "chrome/browser/ui/status_bubble.h" | 131 #include "chrome/browser/ui/status_bubble.h" |
| 133 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 132 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
| 134 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 133 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 135 #include "chrome/browser/ui/tab_dialogs.h" | 134 #include "chrome/browser/ui/tab_dialogs.h" |
| 136 #include "chrome/browser/ui/tab_helpers.h" | 135 #include "chrome/browser/ui/tab_helpers.h" |
| 137 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 136 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 138 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 137 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
| 139 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 138 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 140 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" | |
| 141 #include "chrome/browser/ui/tabs/tab_utils.h" | 139 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 142 #include "chrome/browser/ui/unload_controller.h" | 140 #include "chrome/browser/ui/unload_controller.h" |
| 143 #include "chrome/browser/ui/validation_message_bubble.h" | 141 #include "chrome/browser/ui/validation_message_bubble.h" |
| 144 #include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h" | 142 #include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h" |
| 145 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 143 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 146 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 144 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 147 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 145 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 148 #include "chrome/browser/upgrade_detector.h" | 146 #include "chrome/browser/upgrade_detector.h" |
| 149 #include "chrome/common/chrome_constants.h" | 147 #include "chrome/common/chrome_constants.h" |
| 150 #include "chrome/common/chrome_switches.h" | 148 #include "chrome/common/chrome_switches.h" |
| 151 #include "chrome/common/custom_handlers/protocol_handler.h" | 149 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 152 #include "chrome/common/pref_names.h" | 150 #include "chrome/common/pref_names.h" |
| 153 #include "chrome/common/profiling.h" | 151 #include "chrome/common/profiling.h" |
| 154 #include "chrome/common/search/search_types.h" | 152 #include "chrome/common/search/search_types.h" |
| 155 #include "chrome/common/url_constants.h" | 153 #include "chrome/common/url_constants.h" |
| 156 #include "chrome/grit/chromium_strings.h" | 154 #include "chrome/grit/chromium_strings.h" |
| 157 #include "chrome/grit/generated_resources.h" | 155 #include "chrome/grit/generated_resources.h" |
| 158 #include "chrome/grit/locale_settings.h" | 156 #include "chrome/grit/locale_settings.h" |
| 159 #include "components/bookmarks/browser/bookmark_model.h" | 157 #include "components/bookmarks/browser/bookmark_model.h" |
| 160 #include "components/bookmarks/browser/bookmark_utils.h" | 158 #include "components/bookmarks/browser/bookmark_utils.h" |
| 161 #include "components/bookmarks/common/bookmark_pref_names.h" | 159 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 162 #include "components/browser_sync/profile_sync_service.h" | 160 #include "components/browser_sync/profile_sync_service.h" |
| 163 #include "components/bubble/bubble_controller.h" | 161 #include "components/bubble/bubble_controller.h" |
| 164 #include "components/content_settings/core/browser/host_content_settings_map.h" | 162 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 165 #include "components/favicon/content/content_favicon_driver.h" | 163 #include "components/favicon/content/content_favicon_driver.h" |
| 166 #include "components/history/core/browser/top_sites.h" | |
| 167 #include "components/prefs/pref_service.h" | 164 #include "components/prefs/pref_service.h" |
| 168 #include "components/search/search.h" | 165 #include "components/search/search.h" |
| 169 #include "components/security_state/content/content_utils.h" | 166 #include "components/security_state/content/content_utils.h" |
| 170 #include "components/security_state/core/security_state.h" | 167 #include "components/security_state/core/security_state.h" |
| 171 #include "components/sessions/core/session_types.h" | 168 #include "components/sessions/core/session_types.h" |
| 172 #include "components/sessions/core/tab_restore_service.h" | 169 #include "components/sessions/core/tab_restore_service.h" |
| 173 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 170 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
| 174 #include "components/toolbar/toolbar_model_impl.h" | 171 #include "components/toolbar/toolbar_model_impl.h" |
| 175 #include "components/translate/core/browser/language_state.h" | 172 #include "components/translate/core/browser/language_state.h" |
| 176 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 173 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 const content::WebContents* web_contents) { | 1883 const content::WebContents* web_contents) { |
| 1887 DCHECK(web_contents); | 1884 DCHECK(web_contents); |
| 1888 if (tab_strip_model_->GetActiveWebContents() == web_contents) | 1885 if (tab_strip_model_->GetActiveWebContents() == web_contents) |
| 1889 UpdateToolbar(false); | 1886 UpdateToolbar(false); |
| 1890 } | 1887 } |
| 1891 | 1888 |
| 1892 OmniboxView* Browser::GetOmniboxView() { | 1889 OmniboxView* Browser::GetOmniboxView() { |
| 1893 return window_->GetLocationBar()->GetOmniboxView(); | 1890 return window_->GetLocationBar()->GetOmniboxView(); |
| 1894 } | 1891 } |
| 1895 | 1892 |
| 1896 std::set<std::string> Browser::GetOpenUrls() { | |
| 1897 scoped_refptr<history::TopSites> top_sites = | |
| 1898 TopSitesFactory::GetForProfile(profile_); | |
| 1899 if (!top_sites) // NULL for Incognito profiles. | |
| 1900 return std::set<std::string>(); | |
| 1901 | |
| 1902 std::set<std::string> open_urls; | |
| 1903 chrome::GetOpenUrls(*tab_strip_model_, *top_sites, &open_urls); | |
| 1904 return open_urls; | |
| 1905 } | |
| 1906 | |
| 1907 /////////////////////////////////////////////////////////////////////////////// | 1893 /////////////////////////////////////////////////////////////////////////////// |
| 1908 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: | 1894 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: |
| 1909 | 1895 |
| 1910 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, | 1896 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, |
| 1911 bool blocked) { | 1897 bool blocked) { |
| 1912 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); | 1898 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); |
| 1913 if (index == TabStripModel::kNoTab) { | 1899 if (index == TabStripModel::kNoTab) { |
| 1914 NOTREACHED(); | 1900 NOTREACHED(); |
| 1915 return; | 1901 return; |
| 1916 } | 1902 } |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2600 // new window later, thus we need to navigate the window now. | 2586 // new window later, thus we need to navigate the window now. |
| 2601 if (contents) { | 2587 if (contents) { |
| 2602 contents->web_contents()->GetController().LoadURL( | 2588 contents->web_contents()->GetController().LoadURL( |
| 2603 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2589 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
| 2604 std::string()); // No extra headers. | 2590 std::string()); // No extra headers. |
| 2605 } | 2591 } |
| 2606 } | 2592 } |
| 2607 | 2593 |
| 2608 return contents != NULL; | 2594 return contents != NULL; |
| 2609 } | 2595 } |
| OLD | NEW |