| 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" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "chrome/common/chrome_notification_types.h" | 54 #include "chrome/common/chrome_notification_types.h" |
| 55 #include "chrome/common/chrome_switches.h" | 55 #include "chrome/common/chrome_switches.h" |
| 56 #include "chrome/common/custom_handlers/protocol_handler.h" | 56 #include "chrome/common/custom_handlers/protocol_handler.h" |
| 57 #include "chrome/common/pref_names.h" | 57 #include "chrome/common/pref_names.h" |
| 58 #include "chrome/common/render_messages.h" | 58 #include "chrome/common/render_messages.h" |
| 59 #include "content/browser/child_process_security_policy.h" | 59 #include "content/browser/child_process_security_policy.h" |
| 60 #include "content/browser/renderer_host/render_view_host.h" | 60 #include "content/browser/renderer_host/render_view_host.h" |
| 61 #include "content/browser/tab_contents/navigation_details.h" | 61 #include "content/browser/tab_contents/navigation_details.h" |
| 62 #include "content/browser/tab_contents/tab_contents.h" | 62 #include "content/browser/tab_contents/tab_contents.h" |
| 63 #include "content/browser/tab_contents/tab_contents_view.h" | 63 #include "content/browser/tab_contents/tab_contents_view.h" |
| 64 #include "content/browser/user_metrics.h" |
| 64 #include "content/common/notification_service.h" | 65 #include "content/common/notification_service.h" |
| 65 #include "content/common/view_messages.h" | 66 #include "content/common/view_messages.h" |
| 66 #include "grit/generated_resources.h" | 67 #include "grit/generated_resources.h" |
| 67 #include "grit/locale_settings.h" | 68 #include "grit/locale_settings.h" |
| 68 #include "grit/platform_locale_settings.h" | 69 #include "grit/platform_locale_settings.h" |
| 69 #include "ui/base/l10n/l10n_util.h" | 70 #include "ui/base/l10n/l10n_util.h" |
| 70 #include "webkit/glue/webpreferences.h" | 71 #include "webkit/glue/webpreferences.h" |
| 71 | 72 |
| 72 namespace { | 73 namespace { |
| 73 | 74 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 ProtocolHandler handler = | 575 ProtocolHandler handler = |
| 575 ProtocolHandler::CreateProtocolHandler(protocol, url, title); | 576 ProtocolHandler::CreateProtocolHandler(protocol, url, title); |
| 576 | 577 |
| 577 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); | 578 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); |
| 578 if (!registry->enabled() || registry->IsRegistered(handler) || | 579 if (!registry->enabled() || registry->IsRegistered(handler) || |
| 579 registry->IsIgnored(handler)) | 580 registry->IsIgnored(handler)) |
| 580 return; | 581 return; |
| 581 | 582 |
| 582 if (!handler.IsEmpty() && | 583 if (!handler.IsEmpty() && |
| 583 registry->CanSchemeBeOverridden(handler.protocol())) { | 584 registry->CanSchemeBeOverridden(handler.protocol())) { |
| 585 UserMetrics::RecordAction(UserMetricsAction( |
| 586 "RegisterProtocolHandler.InfoBar_Shown")); |
| 584 AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), | 587 AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), |
| 585 registry, | 588 registry, |
| 586 handler)); | 589 handler)); |
| 587 } | 590 } |
| 588 } | 591 } |
| 589 | 592 |
| 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) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 if (infobars_.empty()) { | 717 if (infobars_.empty()) { |
| 715 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 718 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 716 Source<NavigationController>(&tab_contents_->controller())); | 719 Source<NavigationController>(&tab_contents_->controller())); |
| 717 } | 720 } |
| 718 } | 721 } |
| 719 | 722 |
| 720 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { | 723 void TabContentsWrapper::RemoveAllInfoBars(bool animate) { |
| 721 while (!infobars_.empty()) | 724 while (!infobars_.empty()) |
| 722 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); | 725 RemoveInfoBarInternal(GetInfoBarDelegateAt(infobar_count() - 1), animate); |
| 723 } | 726 } |
| OLD | NEW |