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