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" |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
9 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autocomplete_history_manager.h" | 12 #include "chrome/browser/autocomplete_history_manager.h" |
11 #include "chrome/browser/autofill/autofill_manager.h" | 13 #include "chrome/browser/autofill/autofill_manager.h" |
12 #include "chrome/browser/automation/automation_tab_helper.h" | 14 #include "chrome/browser/automation/automation_tab_helper.h" |
13 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_shutdown.h" | 16 #include "chrome/browser/browser_shutdown.h" |
15 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 17 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
16 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 18 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
17 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" | 19 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
18 #include "chrome/browser/extensions/extension_tab_helper.h" | 20 #include "chrome/browser/extensions/extension_tab_helper.h" |
19 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 21 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
20 #include "chrome/browser/external_protocol/external_protocol_observer.h" | 22 #include "chrome/browser/external_protocol/external_protocol_observer.h" |
21 #include "chrome/browser/favicon/favicon_tab_helper.h" | 23 #include "chrome/browser/favicon/favicon_tab_helper.h" |
22 #include "chrome/browser/file_select_helper.h" | 24 #include "chrome/browser/file_select_helper.h" |
23 #include "chrome/browser/google/google_util.h" | 25 #include "chrome/browser/google/google_util.h" |
24 #include "chrome/browser/history/history_tab_helper.h" | 26 #include "chrome/browser/history/history_tab_helper.h" |
25 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" | 27 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" |
| 28 #include "chrome/browser/intents/web_intent_data.h" |
26 #include "chrome/browser/omnibox_search_hint.h" | 29 #include "chrome/browser/omnibox_search_hint.h" |
27 #include "chrome/browser/password_manager/password_manager.h" | 30 #include "chrome/browser/password_manager/password_manager.h" |
28 #include "chrome/browser/password_manager_delegate_impl.h" | 31 #include "chrome/browser/password_manager_delegate_impl.h" |
29 #include "chrome/browser/pdf_unsupported_feature.h" | 32 #include "chrome/browser/pdf_unsupported_feature.h" |
30 #include "chrome/browser/plugin_observer.h" | 33 #include "chrome/browser/plugin_observer.h" |
31 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
32 #include "chrome/browser/prerender/prerender_observer.h" | 35 #include "chrome/browser/prerender/prerender_observer.h" |
33 #include "chrome/browser/printing/print_preview_message_handler.h" | 36 #include "chrome/browser/printing/print_preview_message_handler.h" |
34 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/remoting/firewall_traversal_tab_helper.h" | 38 #include "chrome/browser/remoting/firewall_traversal_tab_helper.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void TabContentsWrapper::OnRegisterIntentHandler(const string16& action, | 600 void TabContentsWrapper::OnRegisterIntentHandler(const string16& action, |
598 const string16& type, | 601 const string16& type, |
599 const string16& href, | 602 const string16& href, |
600 const string16& title) { | 603 const string16& title) { |
601 if (profile()->IsOffTheRecord()) | 604 if (profile()->IsOffTheRecord()) |
602 return; | 605 return; |
603 | 606 |
604 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) | 607 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) |
605 return; | 608 return; |
606 | 609 |
607 AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(tab_contents())); | 610 GURL service_url(href); |
| 611 if (!service_url.is_valid()) { |
| 612 const GURL& url = tab_contents()->GetURL(); |
| 613 service_url = url.Resolve(href); |
| 614 } |
| 615 |
| 616 WebIntentData intent; |
| 617 intent.service_url = service_url; |
| 618 intent.action = action; |
| 619 intent.type = type; |
| 620 intent.title = title; |
| 621 AddInfoBar(new RegisterIntentHandlerInfoBarDelegate(tab_contents(), intent)); |
608 } | 622 } |
609 | 623 |
610 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { | 624 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { |
611 NotificationService::current()->Notify( | 625 NotificationService::current()->Notify( |
612 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, | 626 chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, |
613 Source<TabContentsWrapper>(this), | 627 Source<TabContentsWrapper>(this), |
614 Details<const SkBitmap>(&bitmap)); | 628 Details<const SkBitmap>(&bitmap)); |
615 } | 629 } |
616 | 630 |
617 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { | 631 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 if (infobars_.empty()) { | 735 if (infobars_.empty()) { |
722 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 736 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
723 Source<NavigationController>(&tab_contents_->controller())); | 737 Source<NavigationController>(&tab_contents_->controller())); |
724 } | 738 } |
725 } | 739 } |
726 | 740 |
727 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { | 741 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { |
728 while (!infobars_.empty()) | 742 while (!infobars_.empty()) |
729 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); | 743 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); |
730 } | 744 } |
OLD | NEW |