| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "chrome/browser/tab_contents/insecure_content_infobar_delegate.h" | 47 #include "chrome/browser/tab_contents/insecure_content_infobar_delegate.h" |
| 48 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" | 48 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" |
| 49 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 49 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 50 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 50 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 51 #include "chrome/browser/themes/theme_service.h" | 51 #include "chrome/browser/themes/theme_service.h" |
| 52 #include "chrome/browser/themes/theme_service_factory.h" | 52 #include "chrome/browser/themes/theme_service_factory.h" |
| 53 #include "chrome/browser/translate/translate_tab_helper.h" | 53 #include "chrome/browser/translate/translate_tab_helper.h" |
| 54 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 54 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 55 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 55 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 56 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 56 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 57 #include "chrome/browser/ui/intents/web_intent_constrained_dialog_factory.h" |
| 58 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 57 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 59 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 58 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" | 60 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" |
| 59 #include "chrome/common/chrome_notification_types.h" | 61 #include "chrome/common/chrome_notification_types.h" |
| 60 #include "chrome/common/chrome_switches.h" | 62 #include "chrome/common/chrome_switches.h" |
| 61 #include "chrome/common/custom_handlers/protocol_handler.h" | 63 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 62 #include "chrome/common/pref_names.h" | 64 #include "chrome/common/pref_names.h" |
| 63 #include "chrome/common/render_messages.h" | 65 #include "chrome/common/render_messages.h" |
| 64 #include "content/browser/child_process_security_policy.h" | 66 #include "content/browser/child_process_security_policy.h" |
| 65 #include "content/browser/renderer_host/render_view_host.h" | 67 #include "content/browser/renderer_host/render_view_host.h" |
| 66 #include "content/browser/tab_contents/navigation_details.h" | 68 #include "content/browser/tab_contents/navigation_details.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 g_browser_process->safe_browsing_detection_service()) { | 151 g_browser_process->safe_browsing_detection_service()) { |
| 150 safebrowsing_detection_host_.reset( | 152 safebrowsing_detection_host_.reset( |
| 151 safe_browsing::ClientSideDetectionHost::Create(contents)); | 153 safe_browsing::ClientSideDetectionHost::Create(contents)); |
| 152 } | 154 } |
| 153 #endif | 155 #endif |
| 154 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); | 156 search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents)); |
| 155 ssl_helper_.reset(new TabContentsSSLHelper(this)); | 157 ssl_helper_.reset(new TabContentsSSLHelper(this)); |
| 156 content_settings_.reset(new TabSpecificContentSettings(contents)); | 158 content_settings_.reset(new TabSpecificContentSettings(contents)); |
| 157 translate_tab_helper_.reset(new TranslateTabHelper(contents)); | 159 translate_tab_helper_.reset(new TranslateTabHelper(contents)); |
| 158 print_view_manager_.reset(new printing::PrintViewManager(this)); | 160 print_view_manager_.reset(new printing::PrintViewManager(this)); |
| 161 web_intent_picker_controller_.reset(new WebIntentPickerController( |
| 162 contents, |
| 163 new WebIntentConstrainedDialogFactory())); |
| 159 | 164 |
| 160 // Create the per-tab observers. | 165 // Create the per-tab observers. |
| 161 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); | 166 external_protocol_observer_.reset(new ExternalProtocolObserver(contents)); |
| 162 download_request_limiter_observer_.reset( | 167 download_request_limiter_observer_.reset( |
| 163 new DownloadRequestLimiterObserver(contents)); | 168 new DownloadRequestLimiterObserver(contents)); |
| 164 file_select_observer_.reset(new FileSelectObserver(contents)); | 169 file_select_observer_.reset(new FileSelectObserver(contents)); |
| 165 plugin_observer_.reset(new PluginObserver(this)); | 170 plugin_observer_.reset(new PluginObserver(this)); |
| 166 prerender_observer_.reset(new prerender::PrerenderObserver(this)); | 171 prerender_observer_.reset(new prerender::PrerenderObserver(this)); |
| 167 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); | 172 print_preview_.reset(new printing::PrintPreviewMessageHandler(contents)); |
| 168 webnavigation_observer_.reset( | 173 webnavigation_observer_.reset( |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 const string16& data, | 643 const string16& data, |
| 639 int intent_id) { | 644 int intent_id) { |
| 640 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) | 645 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) |
| 641 return; | 646 return; |
| 642 | 647 |
| 643 DLOG(INFO) << "Browser tab contents received intent:" | 648 DLOG(INFO) << "Browser tab contents received intent:" |
| 644 << "\naction=" << UTF16ToASCII(action) | 649 << "\naction=" << UTF16ToASCII(action) |
| 645 << "\ntype=" << UTF16ToASCII(type) | 650 << "\ntype=" << UTF16ToASCII(type) |
| 646 << "\nrenderer_id=" << message.routing_id() | 651 << "\nrenderer_id=" << message.routing_id() |
| 647 << "\nid=" << intent_id; | 652 << "\nid=" << intent_id; |
| 653 |
| 654 web_intent_picker_controller_->ShowDialog(action, type); |
| 648 } | 655 } |
| 649 | 656 |
| 650 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { | 657 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { |
| 651 NotificationService::current()->Notify( | 658 NotificationService::current()->Notify( |
| 652 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 659 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, |
| 653 Source<TabContentsWrapper>(this), | 660 Source<TabContentsWrapper>(this), |
| 654 Details<const SkBitmap>(&bitmap)); | 661 Details<const SkBitmap>(&bitmap)); |
| 655 } | 662 } |
| 656 | 663 |
| 657 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { | 664 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if (infobars_.empty()) { | 769 if (infobars_.empty()) { |
| 763 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 770 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 764 Source<NavigationController>(&tab_contents_->controller())); | 771 Source<NavigationController>(&tab_contents_->controller())); |
| 765 } | 772 } |
| 766 } | 773 } |
| 767 | 774 |
| 768 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { | 775 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { |
| 769 while (!infobars_.empty()) | 776 while (!infobars_.empty()) |
| 770 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); | 777 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); |
| 771 } | 778 } |
| OLD | NEW |