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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 #include "chrome/common/chrome_switches.h" | 128 #include "chrome/common/chrome_switches.h" |
129 #include "chrome/common/custom_handlers/protocol_handler.h" | 129 #include "chrome/common/custom_handlers/protocol_handler.h" |
130 #include "chrome/common/extensions/extension.h" | 130 #include "chrome/common/extensions/extension.h" |
131 #include "chrome/common/extensions/extension_constants.h" | 131 #include "chrome/common/extensions/extension_constants.h" |
132 #include "chrome/common/pref_names.h" | 132 #include "chrome/common/pref_names.h" |
133 #include "chrome/common/profiling.h" | 133 #include "chrome/common/profiling.h" |
134 #include "chrome/common/url_constants.h" | 134 #include "chrome/common/url_constants.h" |
135 #include "chrome/common/web_apps.h" | 135 #include "chrome/common/web_apps.h" |
136 #include "content/browser/browser_url_handler.h" | 136 #include "content/browser/browser_url_handler.h" |
137 #include "content/browser/child_process_security_policy.h" | 137 #include "content/browser/child_process_security_policy.h" |
138 #include "content/browser/debugger/devtools_manager.h" | |
139 #include "content/browser/download/download_item.h" | 138 #include "content/browser/download/download_item.h" |
140 #include "content/browser/download/download_manager.h" | 139 #include "content/browser/download/download_manager.h" |
141 #include "content/browser/download/save_package.h" | 140 #include "content/browser/download/save_package.h" |
142 #include "content/browser/host_zoom_map.h" | 141 #include "content/browser/host_zoom_map.h" |
143 #include "content/browser/plugin_service.h" | 142 #include "content/browser/plugin_service.h" |
144 #include "content/browser/renderer_host/render_view_host.h" | 143 #include "content/browser/renderer_host/render_view_host.h" |
145 #include "content/browser/site_instance.h" | 144 #include "content/browser/site_instance.h" |
146 #include "content/browser/tab_contents/interstitial_page.h" | 145 #include "content/browser/tab_contents/interstitial_page.h" |
147 #include "content/browser/tab_contents/navigation_controller.h" | 146 #include "content/browser/tab_contents/navigation_controller.h" |
148 #include "content/browser/tab_contents/navigation_entry.h" | 147 #include "content/browser/tab_contents/navigation_entry.h" |
149 #include "content/browser/tab_contents/tab_contents_view.h" | 148 #include "content/browser/tab_contents/tab_contents_view.h" |
150 #include "content/browser/user_metrics.h" | 149 #include "content/browser/user_metrics.h" |
| 150 #include "content/public/browser/devtools/devtools_manager.h" |
151 #include "content/public/browser/notification_service.h" | 151 #include "content/public/browser/notification_service.h" |
152 #include "content/public/browser/notification_details.h" | 152 #include "content/public/browser/notification_details.h" |
153 #include "content/public/common/content_restriction.h" | 153 #include "content/public/common/content_restriction.h" |
154 #include "content/public/common/content_switches.h" | 154 #include "content/public/common/content_switches.h" |
155 #include "grit/chromium_strings.h" | 155 #include "grit/chromium_strings.h" |
156 #include "grit/generated_resources.h" | 156 #include "grit/generated_resources.h" |
157 #include "grit/locale_settings.h" | 157 #include "grit/locale_settings.h" |
158 #include "grit/theme_resources_standard.h" | 158 #include "grit/theme_resources_standard.h" |
159 #include "net/base/cookie_monster.h" | 159 #include "net/base/cookie_monster.h" |
160 #include "net/base/net_util.h" | 160 #include "net/base/net_util.h" |
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3278 | 3278 |
3279 SessionService* session_service = | 3279 SessionService* session_service = |
3280 SessionServiceFactory::GetForProfile(profile()); | 3280 SessionServiceFactory::GetForProfile(profile()); |
3281 if (session_service) { | 3281 if (session_service) { |
3282 // The new_contents may end up with a different navigation stack. Force | 3282 // The new_contents may end up with a different navigation stack. Force |
3283 // the session service to update itself. | 3283 // the session service to update itself. |
3284 session_service->TabRestored( | 3284 session_service->TabRestored( |
3285 new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); | 3285 new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); |
3286 } | 3286 } |
3287 | 3287 |
3288 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 3288 content::DevToolsManager::GetInstance()->TabReplaced( |
3289 if (devtools_manager) // NULL in unit tests. | 3289 old_contents->tab_contents(), new_contents->tab_contents()); |
3290 devtools_manager->TabReplaced(old_contents->tab_contents(), | |
3291 new_contents->tab_contents()); | |
3292 } | 3290 } |
3293 | 3291 |
3294 void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { | 3292 void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { |
3295 SessionService* session_service = | 3293 SessionService* session_service = |
3296 SessionServiceFactory::GetForProfileIfExisting(profile()); | 3294 SessionServiceFactory::GetForProfileIfExisting(profile()); |
3297 if (session_service) { | 3295 if (session_service) { |
3298 session_service->SetPinnedState( | 3296 session_service->SetPinnedState( |
3299 session_id(), | 3297 session_id(), |
3300 GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), | 3298 GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), |
3301 tab_handler_->GetTabStripModel()->IsTabPinned(index)); | 3299 tab_handler_->GetTabStripModel()->IsTabPinned(index)); |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 instant_unload_handler_.reset(); | 4094 instant_unload_handler_.reset(); |
4097 } | 4095 } |
4098 } else { | 4096 } else { |
4099 CreateInstantIfNecessary(); | 4097 CreateInstantIfNecessary(); |
4100 } | 4098 } |
4101 } else if (pref_name == prefs::kIncognitoModeAvailability) { | 4099 } else if (pref_name == prefs::kIncognitoModeAvailability) { |
4102 UpdateCommandsForIncognitoAvailability(); | 4100 UpdateCommandsForIncognitoAvailability(); |
4103 } else if (pref_name == prefs::kDevToolsDisabled) { | 4101 } else if (pref_name == prefs::kDevToolsDisabled) { |
4104 UpdateCommandsForDevTools(); | 4102 UpdateCommandsForDevTools(); |
4105 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 4103 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
4106 g_browser_process->devtools_manager()->CloseAllClientHosts(); | 4104 content::DevToolsManager::GetInstance()->CloseAllClientHosts(); |
4107 } else if (pref_name == prefs::kEditBookmarksEnabled) { | 4105 } else if (pref_name == prefs::kEditBookmarksEnabled) { |
4108 UpdateCommandsForBookmarkEditing(); | 4106 UpdateCommandsForBookmarkEditing(); |
4109 } else if (pref_name == prefs::kShowBookmarkBar) { | 4107 } else if (pref_name == prefs::kShowBookmarkBar) { |
4110 UpdateCommandsForBookmarkBar(); | 4108 UpdateCommandsForBookmarkBar(); |
4111 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); | 4109 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); |
4112 } else if (pref_name == prefs::kHomePage) { | 4110 } else if (pref_name == prefs::kHomePage) { |
4113 PrefService* pref_service = content::Source<PrefService>(source).ptr(); | 4111 PrefService* pref_service = content::Source<PrefService>(source).ptr(); |
4114 MarkHomePageAsChanged(pref_service); | 4112 MarkHomePageAsChanged(pref_service); |
4115 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { | 4113 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { |
4116 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); | 4114 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5272 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); | 5270 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); |
5273 } else if (is_type_tabbed()) { | 5271 } else if (is_type_tabbed()) { |
5274 GlobalErrorService* service = | 5272 GlobalErrorService* service = |
5275 GlobalErrorServiceFactory::GetForProfile(profile()); | 5273 GlobalErrorServiceFactory::GetForProfile(profile()); |
5276 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5274 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
5277 if (error) { | 5275 if (error) { |
5278 error->ShowBubbleView(this); | 5276 error->ShowBubbleView(this); |
5279 } | 5277 } |
5280 } | 5278 } |
5281 } | 5279 } |
OLD | NEW |