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 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 | 3349 |
3350 SessionService* session_service = | 3350 SessionService* session_service = |
3351 SessionServiceFactory::GetForProfile(profile()); | 3351 SessionServiceFactory::GetForProfile(profile()); |
3352 if (session_service) { | 3352 if (session_service) { |
3353 // The new_contents may end up with a different navigation stack. Force | 3353 // The new_contents may end up with a different navigation stack. Force |
3354 // the session service to update itself. | 3354 // the session service to update itself. |
3355 session_service->TabRestored( | 3355 session_service->TabRestored( |
3356 new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); | 3356 new_contents, tab_handler_->GetTabStripModel()->IsTabPinned(index)); |
3357 } | 3357 } |
3358 | 3358 |
3359 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 3359 content::DevToolsManager::GetInstance()->TabReplaced( |
3360 if (devtools_manager) // NULL in unit tests. | 3360 old_contents->tab_contents(), new_contents->tab_contents()); |
3361 devtools_manager->TabReplaced(old_contents->tab_contents(), | |
3362 new_contents->tab_contents()); | |
3363 } | 3361 } |
3364 | 3362 |
3365 void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { | 3363 void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { |
3366 SessionService* session_service = | 3364 SessionService* session_service = |
3367 SessionServiceFactory::GetForProfileIfExisting(profile()); | 3365 SessionServiceFactory::GetForProfileIfExisting(profile()); |
3368 if (session_service) { | 3366 if (session_service) { |
3369 session_service->SetPinnedState( | 3367 session_service->SetPinnedState( |
3370 session_id(), | 3368 session_id(), |
3371 GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), | 3369 GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), |
3372 tab_handler_->GetTabStripModel()->IsTabPinned(index)); | 3370 tab_handler_->GetTabStripModel()->IsTabPinned(index)); |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4312 instant_unload_handler_.reset(); | 4310 instant_unload_handler_.reset(); |
4313 } | 4311 } |
4314 } else { | 4312 } else { |
4315 CreateInstantIfNecessary(); | 4313 CreateInstantIfNecessary(); |
4316 } | 4314 } |
4317 } else if (pref_name == prefs::kIncognitoModeAvailability) { | 4315 } else if (pref_name == prefs::kIncognitoModeAvailability) { |
4318 UpdateCommandsForIncognitoAvailability(); | 4316 UpdateCommandsForIncognitoAvailability(); |
4319 } else if (pref_name == prefs::kDevToolsDisabled) { | 4317 } else if (pref_name == prefs::kDevToolsDisabled) { |
4320 UpdateCommandsForDevTools(); | 4318 UpdateCommandsForDevTools(); |
4321 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 4319 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
4322 g_browser_process->devtools_manager()->CloseAllClientHosts(); | 4320 content::DevToolsManager::GetInstance()->CloseAllClientHosts(); |
4323 } else if (pref_name == prefs::kEditBookmarksEnabled) { | 4321 } else if (pref_name == prefs::kEditBookmarksEnabled) { |
4324 UpdateCommandsForBookmarkEditing(); | 4322 UpdateCommandsForBookmarkEditing(); |
4325 } else if (pref_name == prefs::kShowBookmarkBar) { | 4323 } else if (pref_name == prefs::kShowBookmarkBar) { |
4326 UpdateCommandsForBookmarkBar(); | 4324 UpdateCommandsForBookmarkBar(); |
4327 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); | 4325 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); |
4328 } else if (pref_name == prefs::kHomePage) { | 4326 } else if (pref_name == prefs::kHomePage) { |
4329 PrefService* pref_service = content::Source<PrefService>(source).ptr(); | 4327 PrefService* pref_service = content::Source<PrefService>(source).ptr(); |
4330 MarkHomePageAsChanged(pref_service); | 4328 MarkHomePageAsChanged(pref_service); |
4331 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { | 4329 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { |
4332 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); | 4330 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5511 } | 5509 } |
5512 | 5510 |
5513 void Browser::UpdateFullscreenExitBubbleContent() { | 5511 void Browser::UpdateFullscreenExitBubbleContent() { |
5514 GURL url; | 5512 GURL url; |
5515 if (fullscreened_tab_) | 5513 if (fullscreened_tab_) |
5516 url = fullscreened_tab_->tab_contents()->GetURL(); | 5514 url = fullscreened_tab_->tab_contents()->GetURL(); |
5517 | 5515 |
5518 window_->UpdateFullscreenExitBubbleContent( | 5516 window_->UpdateFullscreenExitBubbleContent( |
5519 url, GetFullscreenExitBubbleType()); | 5517 url, GetFullscreenExitBubbleType()); |
5520 } | 5518 } |
OLD | NEW |