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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/autocomplete_history_manager.h" | 16 #include "chrome/browser/autocomplete_history_manager.h" |
17 #include "chrome/browser/autofill/autofill_manager.h" | 17 #include "chrome/browser/autofill/autofill_manager.h" |
18 #include "chrome/browser/blocked_content_container.h" | 18 #include "chrome/browser/blocked_content_container.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/browser_shutdown.h" | 20 #include "chrome/browser/browser_shutdown.h" |
21 #include "chrome/browser/character_encoding.h" | 21 #include "chrome/browser/character_encoding.h" |
22 #include "chrome/browser/child_process_security_policy.h" | 22 #include "chrome/browser/child_process_security_policy.h" |
23 #include "chrome/browser/content_settings/content_settings_details.h" | 23 #include "chrome/browser/content_settings/content_settings_details.h" |
24 #include "chrome/browser/content_settings/host_content_settings_map.h" | 24 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 25 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 26 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
25 #include "chrome/browser/debugger/devtools_manager.h" | 27 #include "chrome/browser/debugger/devtools_manager.h" |
26 #include "chrome/browser/defaults.h" | 28 #include "chrome/browser/defaults.h" |
27 #include "chrome/browser/desktop_notification_handler.h" | 29 #include "chrome/browser/desktop_notification_handler.h" |
28 #include "chrome/browser/dom_operation_notification_details.h" | 30 #include "chrome/browser/dom_operation_notification_details.h" |
29 #include "chrome/browser/download/download_item_model.h" | 31 #include "chrome/browser/download/download_item_model.h" |
30 #include "chrome/browser/download/download_manager.h" | 32 #include "chrome/browser/download/download_manager.h" |
31 #include "chrome/browser/download/download_request_limiter.h" | 33 #include "chrome/browser/download/download_request_limiter.h" |
32 #include "chrome/browser/extensions/extension_service.h" | 34 #include "chrome/browser/extensions/extension_service.h" |
33 #include "chrome/browser/external_protocol_handler.h" | 35 #include "chrome/browser/external_protocol_handler.h" |
34 #include "chrome/browser/favicon_service.h" | 36 #include "chrome/browser/favicon_service.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 OnUpdateContentRestrictions) | 441 OnUpdateContentRestrictions) |
440 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, | 442 IPC_MESSAGE_HANDLER(ViewHostMsg_PDFHasUnsupportedFeature, |
441 OnPDFHasUnsupportedFeature) | 443 OnPDFHasUnsupportedFeature) |
442 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 444 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
443 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 445 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |
444 OnDidGetApplicationInfo) | 446 OnDidGetApplicationInfo) |
445 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, | 447 IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, |
446 OnInstallApplication) | 448 OnInstallApplication) |
447 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) | 449 IPC_MESSAGE_HANDLER(ViewHostMsg_PageContents, OnPageContents) |
448 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) | 450 IPC_MESSAGE_HANDLER(ViewHostMsg_PageTranslated, OnPageTranslated) |
| 451 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
| 452 OnRegisterProtocolHandler) |
449 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) | 453 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSuggestions, OnSetSuggestions) |
450 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, | 454 IPC_MESSAGE_HANDLER(ViewHostMsg_InstantSupportDetermined, |
451 OnInstantSupportDetermined) | 455 OnInstantSupportDetermined) |
452 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 456 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
453 IPC_MESSAGE_UNHANDLED(handled = false) | 457 IPC_MESSAGE_UNHANDLED(handled = false) |
454 IPC_END_MESSAGE_MAP_EX() | 458 IPC_END_MESSAGE_MAP_EX() |
455 | 459 |
456 if (!message_is_ok) { | 460 if (!message_is_ok) { |
457 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 461 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
458 GetRenderProcessHost()->ReceivedBadMessage(); | 462 GetRenderProcessHost()->ReceivedBadMessage(); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 TranslateErrors::Type error_type) { | 1960 TranslateErrors::Type error_type) { |
1957 language_state_.set_current_language(translated_lang); | 1961 language_state_.set_current_language(translated_lang); |
1958 language_state_.set_translation_pending(false); | 1962 language_state_.set_translation_pending(false); |
1959 PageTranslatedDetails details(original_lang, translated_lang, error_type); | 1963 PageTranslatedDetails details(original_lang, translated_lang, error_type); |
1960 NotificationService::current()->Notify( | 1964 NotificationService::current()->Notify( |
1961 NotificationType::PAGE_TRANSLATED, | 1965 NotificationType::PAGE_TRANSLATED, |
1962 Source<TabContents>(this), | 1966 Source<TabContents>(this), |
1963 Details<PageTranslatedDetails>(&details)); | 1967 Details<PageTranslatedDetails>(&details)); |
1964 } | 1968 } |
1965 | 1969 |
| 1970 void TabContents::OnRegisterProtocolHandler(const std::string& protocol, |
| 1971 const GURL& url, |
| 1972 const string16& title) { |
| 1973 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); |
| 1974 ProtocolHandler* handler = ProtocolHandler::CreateProtocolHandler(protocol, |
| 1975 url, |
| 1976 title); |
| 1977 if (handler != NULL) { |
| 1978 RegisterProtocolHandlerInfoBarDelegate::AttemptRegisterProtocolHandler( |
| 1979 this, registry, handler); |
| 1980 } |
| 1981 } |
| 1982 |
1966 void TabContents::OnSetSuggestions( | 1983 void TabContents::OnSetSuggestions( |
1967 int32 page_id, | 1984 int32 page_id, |
1968 const std::vector<std::string>& suggestions) { | 1985 const std::vector<std::string>& suggestions) { |
1969 if (delegate()) | 1986 if (delegate()) |
1970 delegate()->OnSetSuggestions(page_id, suggestions); | 1987 delegate()->OnSetSuggestions(page_id, suggestions); |
1971 } | 1988 } |
1972 | 1989 |
1973 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { | 1990 void TabContents::OnInstantSupportDetermined(int32 page_id, bool result) { |
1974 if (delegate()) | 1991 if (delegate()) |
1975 delegate()->OnInstantSupportDetermined(page_id, result); | 1992 delegate()->OnInstantSupportDetermined(page_id, result); |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 } | 2859 } |
2843 | 2860 |
2844 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { | 2861 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { |
2845 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); | 2862 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); |
2846 if (pm != NULL) { | 2863 if (pm != NULL) { |
2847 if (pm->MaybeUsePreloadedPage(this, url)) | 2864 if (pm->MaybeUsePreloadedPage(this, url)) |
2848 return true; | 2865 return true; |
2849 } | 2866 } |
2850 return false; | 2867 return false; |
2851 } | 2868 } |
OLD | NEW |