| 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 <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 #include "chrome/common/chrome_switches.h" | 130 #include "chrome/common/chrome_switches.h" |
| 131 #include "chrome/common/custom_handlers/protocol_handler.h" | 131 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 132 #include "chrome/common/extensions/extension.h" | 132 #include "chrome/common/extensions/extension.h" |
| 133 #include "chrome/common/extensions/extension_constants.h" | 133 #include "chrome/common/extensions/extension_constants.h" |
| 134 #include "chrome/common/pref_names.h" | 134 #include "chrome/common/pref_names.h" |
| 135 #include "chrome/common/profiling.h" | 135 #include "chrome/common/profiling.h" |
| 136 #include "chrome/common/url_constants.h" | 136 #include "chrome/common/url_constants.h" |
| 137 #include "chrome/common/web_apps.h" | 137 #include "chrome/common/web_apps.h" |
| 138 #include "content/browser/browser_url_handler.h" | 138 #include "content/browser/browser_url_handler.h" |
| 139 #include "content/browser/child_process_security_policy.h" | 139 #include "content/browser/child_process_security_policy.h" |
| 140 #include "content/browser/debugger/devtools_manager.h" | |
| 141 #include "content/browser/download/download_item.h" | 140 #include "content/browser/download/download_item.h" |
| 142 #include "content/browser/download/download_manager.h" | 141 #include "content/browser/download/download_manager.h" |
| 143 #include "content/browser/download/save_package.h" | 142 #include "content/browser/download/save_package.h" |
| 144 #include "content/browser/host_zoom_map.h" | 143 #include "content/browser/host_zoom_map.h" |
| 145 #include "content/browser/plugin_service.h" | 144 #include "content/browser/plugin_service.h" |
| 146 #include "content/browser/renderer_host/render_view_host.h" | 145 #include "content/browser/renderer_host/render_view_host.h" |
| 147 #include "content/browser/site_instance.h" | 146 #include "content/browser/site_instance.h" |
| 148 #include "content/browser/tab_contents/interstitial_page.h" | 147 #include "content/browser/tab_contents/interstitial_page.h" |
| 149 #include "content/browser/tab_contents/navigation_controller.h" | 148 #include "content/browser/tab_contents/navigation_controller.h" |
| 150 #include "content/browser/tab_contents/navigation_entry.h" | 149 #include "content/browser/tab_contents/navigation_entry.h" |
| 151 #include "content/browser/tab_contents/tab_contents_view.h" | 150 #include "content/browser/tab_contents/tab_contents_view.h" |
| 152 #include "content/browser/user_metrics.h" | 151 #include "content/browser/user_metrics.h" |
| 152 #include "content/public/browser/devtools_manager.h" |
| 153 #include "content/public/browser/notification_service.h" | 153 #include "content/public/browser/notification_service.h" |
| 154 #include "content/public/browser/notification_details.h" | 154 #include "content/public/browser/notification_details.h" |
| 155 #include "content/public/common/content_restriction.h" | 155 #include "content/public/common/content_restriction.h" |
| 156 #include "content/public/common/content_switches.h" | 156 #include "content/public/common/content_switches.h" |
| 157 #include "content/public/common/page_zoom.h" | 157 #include "content/public/common/page_zoom.h" |
| 158 #include "grit/chromium_strings.h" | 158 #include "grit/chromium_strings.h" |
| 159 #include "grit/generated_resources.h" | 159 #include "grit/generated_resources.h" |
| 160 #include "grit/locale_settings.h" | 160 #include "grit/locale_settings.h" |
| 161 #include "grit/theme_resources_standard.h" | 161 #include "grit/theme_resources_standard.h" |
| 162 #include "net/base/cookie_monster.h" | 162 #include "net/base/cookie_monster.h" |
| (...skipping 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3335 | 3335 |
| 3336 SessionService* session_service = | 3336 SessionService* session_service = |
| 3337 SessionServiceFactory::GetForProfile(profile()); | 3337 SessionServiceFactory::GetForProfile(profile()); |
| 3338 if (session_service) { | 3338 if (session_service) { |
| 3339 // The new_contents may end up with a different navigation stack. Force | 3339 // The new_contents may end up with a different navigation stack. Force |
| 3340 // the session service to update itself. | 3340 // the session service to update itself. |
| 3341 session_service->TabRestored( | 3341 session_service->TabRestored( |
| 3342 new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); | 3342 new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); |
| 3343 } | 3343 } |
| 3344 | 3344 |
| 3345 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 3345 content::DevToolsManager::GetInstance()->TabReplaced( |
| 3346 if (devtools_manager) // NULL in unit tests. | 3346 old_contents->tab_contents(), new_contents->tab_contents()); |
| 3347 devtools_manager->TabReplaced(old_contents->tab_contents(), | |
| 3348 new_contents->tab_contents()); | |
| 3349 } | 3347 } |
| 3350 | 3348 |
| 3351 void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { | 3349 void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { |
| 3352 SessionService* session_service = | 3350 SessionService* session_service = |
| 3353 SessionServiceFactory::GetForProfileIfExisting(profile()); | 3351 SessionServiceFactory::GetForProfileIfExisting(profile()); |
| 3354 if (session_service) { | 3352 if (session_service) { |
| 3355 session_service->SetPinnedState( | 3353 session_service->SetPinnedState( |
| 3356 session_id(), | 3354 session_id(), |
| 3357 GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), | 3355 GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), |
| 3358 tab_handler_->GetTabStripModel()->IsTabPinned(index)); | 3356 tab_handler_->GetTabStripModel()->IsTabPinned(index)); |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4153 instant_unload_handler_.reset(); | 4151 instant_unload_handler_.reset(); |
| 4154 } | 4152 } |
| 4155 } else { | 4153 } else { |
| 4156 CreateInstantIfNecessary(); | 4154 CreateInstantIfNecessary(); |
| 4157 } | 4155 } |
| 4158 } else if (pref_name == prefs::kIncognitoModeAvailability) { | 4156 } else if (pref_name == prefs::kIncognitoModeAvailability) { |
| 4159 UpdateCommandsForIncognitoAvailability(); | 4157 UpdateCommandsForIncognitoAvailability(); |
| 4160 } else if (pref_name == prefs::kDevToolsDisabled) { | 4158 } else if (pref_name == prefs::kDevToolsDisabled) { |
| 4161 UpdateCommandsForDevTools(); | 4159 UpdateCommandsForDevTools(); |
| 4162 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 4160 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
| 4163 DevToolsManager::GetInstance()->CloseAllClientHosts(); | 4161 content::DevToolsManager::GetInstance()->CloseAllClientHosts(); |
| 4164 } else if (pref_name == prefs::kEditBookmarksEnabled) { | 4162 } else if (pref_name == prefs::kEditBookmarksEnabled) { |
| 4165 UpdateCommandsForBookmarkEditing(); | 4163 UpdateCommandsForBookmarkEditing(); |
| 4166 } else if (pref_name == prefs::kShowBookmarkBar) { | 4164 } else if (pref_name == prefs::kShowBookmarkBar) { |
| 4167 UpdateCommandsForBookmarkBar(); | 4165 UpdateCommandsForBookmarkBar(); |
| 4168 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); | 4166 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); |
| 4169 } else if (pref_name == prefs::kHomePage) { | 4167 } else if (pref_name == prefs::kHomePage) { |
| 4170 PrefService* pref_service = content::Source<PrefService>(source).ptr(); | 4168 PrefService* pref_service = content::Source<PrefService>(source).ptr(); |
| 4171 MarkHomePageAsChanged(pref_service); | 4169 MarkHomePageAsChanged(pref_service); |
| 4172 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { | 4170 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { |
| 4173 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); | 4171 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5331 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5329 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
| 5332 } else { | 5330 } else { |
| 5333 GlobalErrorService* service = | 5331 GlobalErrorService* service = |
| 5334 GlobalErrorServiceFactory::GetForProfile(profile()); | 5332 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5335 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5333 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5336 if (error) { | 5334 if (error) { |
| 5337 error->ShowBubbleView(this); | 5335 error->ShowBubbleView(this); |
| 5338 } | 5336 } |
| 5339 } | 5337 } |
| 5340 } | 5338 } |
| OLD | NEW |