| 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/tab_contents/tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "chrome/browser/autocomplete_history_manager.h" | 11 #include "chrome/browser/autocomplete_history_manager.h" |
| 12 #include "chrome/browser/autofill/autofill_manager.h" | 12 #include "chrome/browser/autofill/autofill_manager.h" |
| 13 #include "chrome/browser/automation/automation_tab_helper.h" | 13 #include "chrome/browser/automation/automation_tab_helper.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/browser_shutdown.h" | |
| 16 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 17 #include "chrome/browser/download/download_request_limiter_observer.h" | 16 #include "chrome/browser/download/download_request_limiter_observer.h" |
| 18 #include "chrome/browser/extensions/extension_tab_helper.h" | 17 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 19 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 18 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
| 20 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 19 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
| 21 #include "chrome/browser/favicon/favicon_tab_helper.h" | 20 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 22 #include "chrome/browser/google/google_util.h" | 21 #include "chrome/browser/google/google_util.h" |
| 23 #include "chrome/browser/history/history_tab_helper.h" | 22 #include "chrome/browser/history/history_tab_helper.h" |
| 24 #include "chrome/browser/infobars/infobar_tab_helper.h" | 23 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 25 #include "chrome/browser/omnibox_search_hint.h" | 24 #include "chrome/browser/omnibox_search_hint.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 return Profile::FromBrowserContext(tab_contents()->browser_context()); | 538 return Profile::FromBrowserContext(tab_contents()->browser_context()); |
| 540 } | 539 } |
| 541 | 540 |
| 542 //////////////////////////////////////////////////////////////////////////////// | 541 //////////////////////////////////////////////////////////////////////////////// |
| 543 // TabContentsWrapper implementation: | 542 // TabContentsWrapper implementation: |
| 544 | 543 |
| 545 void TabContentsWrapper::RenderViewCreated(RenderViewHost* render_view_host) { | 544 void TabContentsWrapper::RenderViewCreated(RenderViewHost* render_view_host) { |
| 546 UpdateAlternateErrorPageURL(render_view_host); | 545 UpdateAlternateErrorPageURL(render_view_host); |
| 547 } | 546 } |
| 548 | 547 |
| 549 void TabContentsWrapper::RenderViewGone() { | |
| 550 // Tell the view that we've crashed so it can prepare the sad tab page. | |
| 551 // Only do this if we're not in browser shutdown, so that TabContents | |
| 552 // objects that are not in a browser (e.g., HTML dialogs) and thus are | |
| 553 // visible do not flash a sad tab page. | |
| 554 if (browser_shutdown::GetShutdownType() == browser_shutdown::NOT_VALID) { | |
| 555 tab_contents()->view()->OnTabCrashed( | |
| 556 tab_contents()->crashed_status(), tab_contents()->crashed_error_code()); | |
| 557 } | |
| 558 } | |
| 559 | |
| 560 void TabContentsWrapper::DidBecomeSelected() { | 548 void TabContentsWrapper::DidBecomeSelected() { |
| 561 WebCacheManager::GetInstance()->ObserveActivity( | 549 WebCacheManager::GetInstance()->ObserveActivity( |
| 562 tab_contents()->GetRenderProcessHost()->id()); | 550 tab_contents()->GetRenderProcessHost()->id()); |
| 563 } | 551 } |
| 564 | 552 |
| 565 bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { | 553 bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { |
| 566 bool handled = true; | 554 bool handled = true; |
| 567 IPC_BEGIN_MESSAGE_MAP(TabContentsWrapper, message) | 555 IPC_BEGIN_MESSAGE_MAP(TabContentsWrapper, message) |
| 568 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Snapshot, OnSnapshot) | 556 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Snapshot, OnSnapshot) |
| 569 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature, | 557 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PDFHasUnsupportedFeature, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 } | 669 } |
| 682 render_view_host()->Send( | 670 render_view_host()->Send( |
| 683 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), | 671 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), |
| 684 safe_browsing)); | 672 safe_browsing)); |
| 685 #endif | 673 #endif |
| 686 } | 674 } |
| 687 | 675 |
| 688 void TabContentsWrapper::ExitFullscreenMode() { | 676 void TabContentsWrapper::ExitFullscreenMode() { |
| 689 tab_contents()->render_view_host()->ExitFullscreen(); | 677 tab_contents()->render_view_host()->ExitFullscreen(); |
| 690 } | 678 } |
| OLD | NEW |