| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 TabContentsWrapper* TabContentsWrapper::Clone() { | 359 TabContentsWrapper* TabContentsWrapper::Clone() { |
| 360 TabContents* new_contents = tab_contents()->Clone(); | 360 TabContents* new_contents = tab_contents()->Clone(); |
| 361 TabContentsWrapper* new_wrapper = new TabContentsWrapper(new_contents); | 361 TabContentsWrapper* new_wrapper = new TabContentsWrapper(new_contents); |
| 362 | 362 |
| 363 new_wrapper->extension_tab_helper()->CopyStateFrom( | 363 new_wrapper->extension_tab_helper()->CopyStateFrom( |
| 364 *extension_tab_helper_.get()); | 364 *extension_tab_helper_.get()); |
| 365 return new_wrapper; | 365 return new_wrapper; |
| 366 } | 366 } |
| 367 | 367 |
| 368 void TabContentsWrapper::CaptureSnapshot() { | 368 void TabContentsWrapper::CaptureSnapshot() { |
| 369 Send(new ViewMsg_CaptureSnapshot(routing_id())); | 369 Send(new ChromeViewMsg_CaptureSnapshot(routing_id())); |
| 370 } | 370 } |
| 371 | 371 |
| 372 // static | 372 // static |
| 373 TabContentsWrapper* TabContentsWrapper::GetCurrentWrapperForContents( | 373 TabContentsWrapper* TabContentsWrapper::GetCurrentWrapperForContents( |
| 374 TabContents* contents) { | 374 TabContents* contents) { |
| 375 TabContentsWrapper** wrapper = | 375 TabContentsWrapper** wrapper = |
| 376 property_accessor()->GetProperty(contents->property_bag()); | 376 property_accessor()->GetProperty(contents->property_bag()); |
| 377 | 377 |
| 378 return wrapper ? *wrapper : NULL; | 378 return wrapper ? *wrapper : NULL; |
| 379 } | 379 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { | 419 bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { |
| 420 bool handled = true; | 420 bool handled = true; |
| 421 IPC_BEGIN_MESSAGE_MAP(TabContentsWrapper, message) | 421 IPC_BEGIN_MESSAGE_MAP(TabContentsWrapper, message) |
| 422 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 422 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
| 423 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 423 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
| 424 OnRegisterProtocolHandler) | 424 OnRegisterProtocolHandler) |
| 425 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterIntentHandler, | 425 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterIntentHandler, |
| 426 OnRegisterIntentHandler) | 426 OnRegisterIntentHandler) |
| 427 IPC_MESSAGE_HANDLER(ViewHostMsg_WebIntentDispatch, | 427 IPC_MESSAGE_HANDLER(ViewHostMsg_WebIntentDispatch, |
| 428 OnWebIntentDispatch) | 428 OnWebIntentDispatch) |
| 429 IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnSnapshot) | 429 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Snapshot, OnSnapshot) |
| 430 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, | 430 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, |
| 431 OnPDFHasUnsupportedFeature) | 431 OnPDFHasUnsupportedFeature) |
| 432 IPC_MESSAGE_HANDLER(ViewHostMsg_DidBlockDisplayingInsecureContent, | 432 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidBlockDisplayingInsecureContent, |
| 433 OnDidBlockDisplayingInsecureContent) | 433 OnDidBlockDisplayingInsecureContent) |
| 434 IPC_MESSAGE_HANDLER(ViewHostMsg_DidBlockRunningInsecureContent, | 434 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidBlockRunningInsecureContent, |
| 435 OnDidBlockRunningInsecureContent) | 435 OnDidBlockRunningInsecureContent) |
| 436 IPC_MESSAGE_UNHANDLED(handled = false) | 436 IPC_MESSAGE_UNHANDLED(handled = false) |
| 437 IPC_END_MESSAGE_MAP() | 437 IPC_END_MESSAGE_MAP() |
| 438 return handled; | 438 return handled; |
| 439 } | 439 } |
| 440 | 440 |
| 441 void TabContentsWrapper::TabContentsDestroyed(TabContents* tab) { | 441 void TabContentsWrapper::TabContentsDestroyed(TabContents* tab) { |
| 442 // Destruction of the TabContents should only be done by us from our | 442 // Destruction of the TabContents should only be done by us from our |
| 443 // destructor. Otherwise it's very likely we (or one of the helpers we own) | 443 // destructor. Otherwise it's very likely we (or one of the helpers we own) |
| 444 // will attempt to access the TabContents and we'll crash. | 444 // will attempt to access the TabContents and we'll crash. |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 if (safe_browsing && | 717 if (safe_browsing && |
| 718 g_browser_process->safe_browsing_detection_service()) { | 718 g_browser_process->safe_browsing_detection_service()) { |
| 719 if (!safebrowsing_detection_host_.get()) { | 719 if (!safebrowsing_detection_host_.get()) { |
| 720 safebrowsing_detection_host_.reset( | 720 safebrowsing_detection_host_.reset( |
| 721 safe_browsing::ClientSideDetectionHost::Create(tab_contents())); | 721 safe_browsing::ClientSideDetectionHost::Create(tab_contents())); |
| 722 } | 722 } |
| 723 } else { | 723 } else { |
| 724 safebrowsing_detection_host_.reset(); | 724 safebrowsing_detection_host_.reset(); |
| 725 } | 725 } |
| 726 render_view_host()->Send( | 726 render_view_host()->Send( |
| 727 new ViewMsg_SetClientSidePhishingDetection(routing_id(), safe_browsing)); | 727 new ChromeViewMsg_SetClientSidePhishingDetection(routing_id(), |
| 728 safe_browsing)); |
| 728 #endif | 729 #endif |
| 729 } | 730 } |
| 730 | 731 |
| 731 void TabContentsWrapper::RemoveInfoBarInternal(InfoBarDelegate* delegate, | 732 void TabContentsWrapper::RemoveInfoBarInternal(InfoBarDelegate* delegate, |
| 732 bool animate) { | 733 bool animate) { |
| 733 if (!infobars_enabled_) { | 734 if (!infobars_enabled_) { |
| 734 DCHECK(infobars_.empty()); | 735 DCHECK(infobars_.empty()); |
| 735 return; | 736 return; |
| 736 } | 737 } |
| 737 | 738 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 755 if (infobars_.empty()) { | 756 if (infobars_.empty()) { |
| 756 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 757 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 757 Source<NavigationController>(&tab_contents_->controller())); | 758 Source<NavigationController>(&tab_contents_->controller())); |
| 758 } | 759 } |
| 759 } | 760 } |
| 760 | 761 |
| 761 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { | 762 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { |
| 762 while (!infobars_.empty()) | 763 while (!infobars_.empty()) |
| 763 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); | 764 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); |
| 764 } | 765 } |
| OLD | NEW |