| 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/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/autocomplete_history_manager.h" | 9 #include "chrome/browser/autocomplete_history_manager.h" | 
| 10 #include "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" | 
| 11 #include "chrome/browser/automation/automation_tab_helper.h" | 11 #include "chrome/browser/automation/automation_tab_helper.h" | 
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" | 
| 13 #include "chrome/browser/browser_shutdown.h" | 13 #include "chrome/browser/browser_shutdown.h" | 
| 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 
| 15 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 15 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 
| 16 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
     ate.h" | 16 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
     ate.h" | 
| 17 #include "chrome/browser/extensions/extension_tab_helper.h" | 17 #include "chrome/browser/extensions/extension_tab_helper.h" | 
| 18 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 18 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 
| 19 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 19 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 
| 20 #include "chrome/browser/favicon/favicon_tab_helper.h" | 20 #include "chrome/browser/favicon/favicon_tab_helper.h" | 
| 21 #include "chrome/browser/file_select_helper.h" | 21 #include "chrome/browser/file_select_helper.h" | 
| 22 #include "chrome/browser/google/google_util.h" | 22 #include "chrome/browser/google/google_util.h" | 
| 23 #include "chrome/browser/history/history_tab_helper.h" | 23 #include "chrome/browser/history/history_tab_helper.h" | 
|  | 24 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" | 
| 24 #include "chrome/browser/omnibox_search_hint.h" | 25 #include "chrome/browser/omnibox_search_hint.h" | 
| 25 #include "chrome/browser/password_manager/password_manager.h" | 26 #include "chrome/browser/password_manager/password_manager.h" | 
| 26 #include "chrome/browser/password_manager_delegate_impl.h" | 27 #include "chrome/browser/password_manager_delegate_impl.h" | 
| 27 #include "chrome/browser/pdf_unsupported_feature.h" | 28 #include "chrome/browser/pdf_unsupported_feature.h" | 
| 28 #include "chrome/browser/plugin_observer.h" | 29 #include "chrome/browser/plugin_observer.h" | 
| 29 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" | 
| 30 #include "chrome/browser/prerender/prerender_observer.h" | 31 #include "chrome/browser/prerender/prerender_observer.h" | 
| 31 #include "chrome/browser/printing/print_preview_message_handler.h" | 32 #include "chrome/browser/printing/print_preview_message_handler.h" | 
| 32 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" | 
| 33 #include "chrome/browser/renderer_host/web_cache_manager.h" | 34 #include "chrome/browser/renderer_host/web_cache_manager.h" | 
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 390   WebCacheManager::GetInstance()->ObserveActivity( | 391   WebCacheManager::GetInstance()->ObserveActivity( | 
| 391       tab_contents()->GetRenderProcessHost()->id()); | 392       tab_contents()->GetRenderProcessHost()->id()); | 
| 392 } | 393 } | 
| 393 | 394 | 
| 394 bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { | 395 bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { | 
| 395   bool handled = true; | 396   bool handled = true; | 
| 396   IPC_BEGIN_MESSAGE_MAP(TabContentsWrapper, message) | 397   IPC_BEGIN_MESSAGE_MAP(TabContentsWrapper, message) | 
| 397     IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 398     IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 
| 398     IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 399     IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 
| 399                         OnRegisterProtocolHandler) | 400                         OnRegisterProtocolHandler) | 
|  | 401     IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterIntentHandler, | 
|  | 402                         OnRegisterIntentHandler) | 
| 400     IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnSnapshot) | 403     IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnSnapshot) | 
| 401     IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, | 404     IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, | 
| 402                         OnPDFHasUnsupportedFeature) | 405                         OnPDFHasUnsupportedFeature) | 
| 403     IPC_MESSAGE_HANDLER(ViewHostMsg_DidBlockDisplayingInsecureContent, | 406     IPC_MESSAGE_HANDLER(ViewHostMsg_DidBlockDisplayingInsecureContent, | 
| 404                         OnDidBlockDisplayingInsecureContent) | 407                         OnDidBlockDisplayingInsecureContent) | 
| 405     IPC_MESSAGE_HANDLER(ViewHostMsg_DidBlockRunningInsecureContent, | 408     IPC_MESSAGE_HANDLER(ViewHostMsg_DidBlockRunningInsecureContent, | 
| 406                         OnDidBlockRunningInsecureContent) | 409                         OnDidBlockRunningInsecureContent) | 
| 407     IPC_MESSAGE_UNHANDLED(handled = false) | 410     IPC_MESSAGE_UNHANDLED(handled = false) | 
| 408   IPC_END_MESSAGE_MAP() | 411   IPC_END_MESSAGE_MAP() | 
| 409   return handled; | 412   return handled; | 
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 563     return; | 566     return; | 
| 564 | 567 | 
| 565   if (!handler.IsEmpty() && | 568   if (!handler.IsEmpty() && | 
| 566       registry->CanSchemeBeOverridden(handler.protocol())) { | 569       registry->CanSchemeBeOverridden(handler.protocol())) { | 
| 567     AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), | 570     AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), | 
| 568                                                           registry, | 571                                                           registry, | 
| 569                                                           handler)); | 572                                                           handler)); | 
| 570   } | 573   } | 
| 571 } | 574 } | 
| 572 | 575 | 
|  | 576 void TabContentsWrapper::OnRegisterIntentHandler(const string16& action, | 
|  | 577                                                  const string16& type, | 
|  | 578                                                  const string16& href, | 
|  | 579                                                  const string16& title) { | 
|  | 580   if (profile()->IsOffTheRecord()) | 
|  | 581     return; | 
|  | 582 | 
|  | 583   if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) | 
|  | 584     return; | 
|  | 585 | 
|  | 586   AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(tab_contents())); | 
|  | 587 } | 
|  | 588 | 
| 573 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { | 589 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { | 
| 574   NotificationService::current()->Notify( | 590   NotificationService::current()->Notify( | 
| 575       chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 591       chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 
| 576       Source<TabContentsWrapper>(this), | 592       Source<TabContentsWrapper>(this), | 
| 577       Details<const SkBitmap>(&bitmap)); | 593       Details<const SkBitmap>(&bitmap)); | 
| 578 } | 594 } | 
| 579 | 595 | 
| 580 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { | 596 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { | 
| 581   PDFHasUnsupportedFeature(this); | 597   PDFHasUnsupportedFeature(this); | 
| 582 } | 598 } | 
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 683   if (infobars_.empty()) { | 699   if (infobars_.empty()) { | 
| 684     registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 700     registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 
| 685         Source<NavigationController>(&tab_contents_->controller())); | 701         Source<NavigationController>(&tab_contents_->controller())); | 
| 686   } | 702   } | 
| 687 } | 703 } | 
| 688 | 704 | 
| 689 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { | 705 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { | 
| 690   while (!infobars_.empty()) | 706   while (!infobars_.empty()) | 
| 691     RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); | 707     RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); | 
| 692 } | 708 } | 
| OLD | NEW | 
|---|