OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "chrome/browser/autofill/autocomplete_history_manager.h" | 9 #include "chrome/browser/autofill/autocomplete_history_manager.h" |
10 #include "chrome/browser/autofill/autofill_external_delegate.h" | 10 #include "chrome/browser/autofill/autofill_external_delegate.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/net/cache_stats.h" | 21 #include "chrome/browser/net/cache_stats.h" |
22 #include "chrome/browser/omnibox_search_hint.h" | 22 #include "chrome/browser/omnibox_search_hint.h" |
23 #include "chrome/browser/password_manager/password_manager.h" | 23 #include "chrome/browser/password_manager/password_manager.h" |
24 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" | 24 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
25 #include "chrome/browser/plugin_observer.h" | 25 #include "chrome/browser/plugin_observer.h" |
26 #include "chrome/browser/prerender/prerender_tab_helper.h" | 26 #include "chrome/browser/prerender/prerender_tab_helper.h" |
27 #include "chrome/browser/printing/print_preview_message_handler.h" | 27 #include "chrome/browser/printing/print_preview_message_handler.h" |
28 #include "chrome/browser/printing/print_view_manager.h" | 28 #include "chrome/browser/printing/print_view_manager.h" |
29 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" | 29 #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" |
30 #include "chrome/browser/sessions/restore_tab_helper.h" | 30 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 31 #include "chrome/browser/sessions/session_service.h" |
| 32 #include "chrome/browser/sessions/session_service_factory.h" |
31 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" | 33 #include "chrome/browser/tab_contents/navigation_metrics_recorder.h" |
32 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 34 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
33 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 35 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
34 #include "chrome/browser/translate/translate_tab_helper.h" | 36 #include "chrome/browser/translate/translate_tab_helper.h" |
35 #include "chrome/browser/ui/alternate_error_tab_observer.h" | 37 #include "chrome/browser/ui/alternate_error_tab_observer.h" |
36 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 38 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
37 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 39 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
38 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 40 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
39 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 41 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
40 #include "chrome/browser/ui/hung_plugin_tab_helper.h" | 42 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 246 |
245 //////////////////////////////////////////////////////////////////////////////// | 247 //////////////////////////////////////////////////////////////////////////////// |
246 // WebContentsObserver overrides | 248 // WebContentsObserver overrides |
247 | 249 |
248 void TabContents::WebContentsDestroyed(WebContents* tab) { | 250 void TabContents::WebContentsDestroyed(WebContents* tab) { |
249 // Destruction of the WebContents should only be done by us from our | 251 // Destruction of the WebContents should only be done by us from our |
250 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 252 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
251 // will attempt to access the WebContents and we'll crash. | 253 // will attempt to access the WebContents and we'll crash. |
252 DCHECK(in_destructor_); | 254 DCHECK(in_destructor_); |
253 } | 255 } |
| 256 |
| 257 void TabContents::SetUserAgentOverride(const std::string& user_agent) { |
| 258 #if defined(ENABLE_SESSION_SERVICE) |
| 259 SessionService* session = |
| 260 SessionServiceFactory::GetForProfile(profile()); |
| 261 if (session) { |
| 262 session->SetTabUserAgentOverride(restore_tab_helper()->window_id(), |
| 263 restore_tab_helper()->session_id(), |
| 264 user_agent); |
| 265 } |
| 266 #endif |
| 267 } |
OLD | NEW |