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/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/debugger/devtools_manager.h" | 25 #include "chrome/browser/debugger/devtools_manager.h" |
26 #include "chrome/browser/defaults.h" | 26 #include "chrome/browser/defaults.h" |
27 #include "chrome/browser/desktop_notification_handler.h" | 27 #include "chrome/browser/desktop_notification_handler.h" |
28 #include "chrome/browser/dom_operation_notification_details.h" | 28 #include "chrome/browser/dom_operation_notification_details.h" |
29 #include "chrome/browser/dom_ui/web_ui.h" | |
30 #include "chrome/browser/download/download_item_model.h" | 29 #include "chrome/browser/download/download_item_model.h" |
31 #include "chrome/browser/download/download_manager.h" | 30 #include "chrome/browser/download/download_manager.h" |
32 #include "chrome/browser/download/download_request_limiter.h" | 31 #include "chrome/browser/download/download_request_limiter.h" |
33 #include "chrome/browser/extensions/extension_service.h" | 32 #include "chrome/browser/extensions/extension_service.h" |
34 #include "chrome/browser/external_protocol_handler.h" | 33 #include "chrome/browser/external_protocol_handler.h" |
35 #include "chrome/browser/favicon_service.h" | 34 #include "chrome/browser/favicon_service.h" |
36 #include "chrome/browser/file_select_helper.h" | 35 #include "chrome/browser/file_select_helper.h" |
37 #include "chrome/browser/google/google_util.h" | 36 #include "chrome/browser/google/google_util.h" |
38 #include "chrome/browser/history/history.h" | 37 #include "chrome/browser/history/history.h" |
39 #include "chrome/browser/history/history_types.h" | 38 #include "chrome/browser/history/history_types.h" |
40 #include "chrome/browser/history/top_sites.h" | 39 #include "chrome/browser/history/top_sites.h" |
41 #include "chrome/browser/host_zoom_map.h" | 40 #include "chrome/browser/host_zoom_map.h" |
42 #include "chrome/browser/hung_renderer_dialog.h" | 41 #include "chrome/browser/hung_renderer_dialog.h" |
43 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" | 42 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
44 #include "chrome/browser/load_from_memory_cache_details.h" | 43 #include "chrome/browser/load_from_memory_cache_details.h" |
45 #include "chrome/browser/load_notification_details.h" | 44 #include "chrome/browser/load_notification_details.h" |
46 #include "chrome/browser/metrics/metric_event_duration_details.h" | 45 #include "chrome/browser/metrics/metric_event_duration_details.h" |
47 #include "chrome/browser/metrics/user_metrics.h" | 46 #include "chrome/browser/metrics/user_metrics.h" |
48 #include "chrome/browser/modal_html_dialog_delegate.h" | 47 #include "chrome/browser/modal_html_dialog_delegate.h" |
49 #include "chrome/browser/omnibox_search_hint.h" | 48 #include "chrome/browser/omnibox_search_hint.h" |
50 #include "chrome/browser/pdf_unsupported_feature.h" | 49 #include "chrome/browser/pdf_unsupported_feature.h" |
51 #include "chrome/browser/platform_util.h" | 50 #include "chrome/browser/platform_util.h" |
52 #include "chrome/browser/plugin_observer.h" | 51 #include "chrome/browser/plugin_observer.h" |
53 #include "chrome/browser/prefs/pref_service.h" | |
54 #include "chrome/browser/prerender/prerender_manager.h" | 52 #include "chrome/browser/prerender/prerender_manager.h" |
55 #include "chrome/browser/prerender/prerender_plt_recorder.h" | 53 #include "chrome/browser/prerender/prerender_plt_recorder.h" |
56 #include "chrome/browser/printing/print_preview_message_handler.h" | 54 #include "chrome/browser/printing/print_preview_message_handler.h" |
57 #include "chrome/browser/printing/print_preview_tab_controller.h" | 55 #include "chrome/browser/printing/print_preview_tab_controller.h" |
58 #include "chrome/browser/printing/print_view_manager.h" | 56 #include "chrome/browser/printing/print_view_manager.h" |
59 #include "chrome/browser/profiles/profile.h" | 57 #include "chrome/browser/profiles/profile.h" |
60 #include "chrome/browser/renderer_host/render_process_host.h" | 58 #include "chrome/browser/renderer_host/render_process_host.h" |
61 #include "chrome/browser/renderer_host/render_view_host.h" | 59 #include "chrome/browser/renderer_host/render_view_host.h" |
62 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 60 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
63 #include "chrome/browser/renderer_host/resource_request_details.h" | 61 #include "chrome/browser/renderer_host/resource_request_details.h" |
64 #include "chrome/browser/renderer_host/site_instance.h" | 62 #include "chrome/browser/renderer_host/site_instance.h" |
65 #include "chrome/browser/renderer_host/web_cache_manager.h" | 63 #include "chrome/browser/renderer_host/web_cache_manager.h" |
66 #include "chrome/browser/renderer_preferences_util.h" | 64 #include "chrome/browser/renderer_preferences_util.h" |
67 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 65 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
68 #include "chrome/browser/sessions/session_types.h" | 66 #include "chrome/browser/sessions/session_types.h" |
69 #include "chrome/browser/tab_contents/infobar_delegate.h" | |
70 #include "chrome/browser/tab_contents/interstitial_page.h" | |
71 #include "chrome/browser/tab_contents/navigation_entry.h" | |
72 #include "chrome/browser/tab_contents/provisional_load_details.h" | |
73 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | |
74 #include "chrome/browser/tab_contents/tab_contents_observer.h" | |
75 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 67 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
76 #include "chrome/browser/tab_contents/tab_contents_view.h" | |
77 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 68 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
78 #include "chrome/browser/translate/page_translated_details.h" | 69 #include "chrome/browser/translate/page_translated_details.h" |
79 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 70 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 71 #include "chrome/browser/webui/web_ui.h" |
80 #include "chrome/common/bindings_policy.h" | 72 #include "chrome/common/bindings_policy.h" |
81 #include "chrome/common/chrome_switches.h" | 73 #include "chrome/common/chrome_switches.h" |
82 #include "chrome/common/content_restriction.h" | 74 #include "chrome/common/content_restriction.h" |
83 #include "chrome/common/extensions/extension.h" | 75 #include "chrome/common/extensions/extension.h" |
84 #include "chrome/common/extensions/extension_action.h" | 76 #include "chrome/common/extensions/extension_action.h" |
85 #include "chrome/common/extensions/extension_icon_set.h" | 77 #include "chrome/common/extensions/extension_icon_set.h" |
86 #include "chrome/common/extensions/extension_resource.h" | 78 #include "chrome/common/extensions/extension_resource.h" |
87 #include "chrome/common/extensions/url_pattern.h" | 79 #include "chrome/common/extensions/url_pattern.h" |
88 #include "chrome/common/navigation_types.h" | 80 #include "chrome/common/navigation_types.h" |
89 #include "chrome/common/net/url_request_context_getter.h" | 81 #include "chrome/common/net/url_request_context_getter.h" |
90 #include "chrome/common/notification_service.h" | 82 #include "chrome/common/notification_service.h" |
91 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
92 #include "chrome/common/render_messages.h" | 84 #include "chrome/common/render_messages.h" |
93 #include "chrome/common/render_messages_params.h" | 85 #include "chrome/common/render_messages_params.h" |
94 #include "chrome/common/url_constants.h" | 86 #include "chrome/common/url_constants.h" |
95 #include "grit/chromium_strings.h" | 87 #include "content/browser/tab_contents/infobar_delegate.h" |
96 #include "grit/generated_resources.h" | 88 #include "content/browser/tab_contents/interstitial_page.h" |
97 #include "grit/locale_settings.h" | 89 #include "content/browser/tab_contents/navigation_entry.h" |
98 #include "grit/platform_locale_settings.h" | 90 #include "content/browser/tab_contents/provisional_load_details.h" |
99 #include "grit/theme_resources.h" | 91 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 92 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 93 #include "content/browser/tab_contents/tab_contents_view.h" |
100 #include "net/base/net_util.h" | 94 #include "net/base/net_util.h" |
101 #include "net/base/registry_controlled_domain.h" | 95 #include "net/base/registry_controlled_domain.h" |
102 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 96 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
103 #include "ui/base/l10n/l10n_util.h" | |
104 #include "ui/base/resource/resource_bundle.h" | 97 #include "ui/base/resource/resource_bundle.h" |
105 #include "ui/gfx/codec/png_codec.h" | 98 #include "ui/gfx/codec/png_codec.h" |
106 #include "webkit/glue/password_form.h" | 99 #include "webkit/glue/password_form.h" |
107 #include "webkit/glue/webpreferences.h" | 100 #include "webkit/glue/webpreferences.h" |
108 | 101 |
109 #if defined(OS_MACOSX) | 102 #if defined(OS_MACOSX) |
110 #include "app/surface/io_surface_support_mac.h" | 103 #include "app/surface/io_surface_support_mac.h" |
111 #endif // defined(OS_MACOSX) | 104 #endif // defined(OS_MACOSX) |
112 | 105 |
113 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 autofill_manager_.reset(new AutoFillManager(this)); | 403 autofill_manager_.reset(new AutoFillManager(this)); |
411 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); | 404 autocomplete_history_manager_.reset(new AutocompleteHistoryManager(this)); |
412 prerender_plt_recorder_.reset(new prerender::PrerenderPLTRecorder(this)); | 405 prerender_plt_recorder_.reset(new prerender::PrerenderPLTRecorder(this)); |
413 desktop_notification_handler_.reset( | 406 desktop_notification_handler_.reset( |
414 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost())); | 407 new DesktopNotificationHandlerForTC(this, GetRenderProcessHost())); |
415 plugin_observer_.reset(new PluginObserver(this)); | 408 plugin_observer_.reset(new PluginObserver(this)); |
416 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost( | 409 safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost( |
417 this)); | 410 this)); |
418 } | 411 } |
419 | 412 |
420 // static | |
421 void TabContents::RegisterUserPrefs(PrefService* prefs) { | |
422 prefs->RegisterBooleanPref(prefs::kAlternateErrorPagesEnabled, true); | |
423 | |
424 WebPreferences pref_defaults; | |
425 prefs->RegisterBooleanPref(prefs::kWebKitJavascriptEnabled, | |
426 pref_defaults.javascript_enabled); | |
427 prefs->RegisterBooleanPref(prefs::kWebKitWebSecurityEnabled, | |
428 pref_defaults.web_security_enabled); | |
429 prefs->RegisterBooleanPref( | |
430 prefs::kWebKitJavascriptCanOpenWindowsAutomatically, true); | |
431 prefs->RegisterBooleanPref(prefs::kWebKitLoadsImagesAutomatically, | |
432 pref_defaults.loads_images_automatically); | |
433 prefs->RegisterBooleanPref(prefs::kWebKitPluginsEnabled, | |
434 pref_defaults.plugins_enabled); | |
435 prefs->RegisterBooleanPref(prefs::kWebKitDomPasteEnabled, | |
436 pref_defaults.dom_paste_enabled); | |
437 prefs->RegisterBooleanPref(prefs::kWebKitShrinksStandaloneImagesToFit, | |
438 pref_defaults.shrinks_standalone_images_to_fit); | |
439 prefs->RegisterDictionaryPref(prefs::kWebKitInspectorSettings); | |
440 prefs->RegisterBooleanPref(prefs::kWebKitTextAreasAreResizable, | |
441 pref_defaults.text_areas_are_resizable); | |
442 prefs->RegisterBooleanPref(prefs::kWebKitJavaEnabled, | |
443 pref_defaults.java_enabled); | |
444 prefs->RegisterBooleanPref(prefs::kWebkitTabsToLinks, | |
445 pref_defaults.tabs_to_links); | |
446 | |
447 prefs->RegisterLocalizedStringPref(prefs::kAcceptLanguages, | |
448 IDS_ACCEPT_LANGUAGES); | |
449 prefs->RegisterLocalizedStringPref(prefs::kDefaultCharset, | |
450 IDS_DEFAULT_ENCODING); | |
451 prefs->RegisterLocalizedBooleanPref(prefs::kWebKitStandardFontIsSerif, | |
452 IDS_STANDARD_FONT_IS_SERIF); | |
453 prefs->RegisterLocalizedStringPref(prefs::kWebKitFixedFontFamily, | |
454 IDS_FIXED_FONT_FAMILY); | |
455 prefs->RegisterLocalizedStringPref(prefs::kWebKitSerifFontFamily, | |
456 IDS_SERIF_FONT_FAMILY); | |
457 prefs->RegisterLocalizedStringPref(prefs::kWebKitSansSerifFontFamily, | |
458 IDS_SANS_SERIF_FONT_FAMILY); | |
459 prefs->RegisterLocalizedStringPref(prefs::kWebKitCursiveFontFamily, | |
460 IDS_CURSIVE_FONT_FAMILY); | |
461 prefs->RegisterLocalizedStringPref(prefs::kWebKitFantasyFontFamily, | |
462 IDS_FANTASY_FONT_FAMILY); | |
463 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFontSize, | |
464 IDS_DEFAULT_FONT_SIZE); | |
465 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitDefaultFixedFontSize, | |
466 IDS_DEFAULT_FIXED_FONT_SIZE); | |
467 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumFontSize, | |
468 IDS_MINIMUM_FONT_SIZE); | |
469 prefs->RegisterLocalizedIntegerPref(prefs::kWebKitMinimumLogicalFontSize, | |
470 IDS_MINIMUM_LOGICAL_FONT_SIZE); | |
471 prefs->RegisterLocalizedBooleanPref(prefs::kWebKitUsesUniversalDetector, | |
472 IDS_USES_UNIVERSAL_DETECTOR); | |
473 prefs->RegisterLocalizedStringPref(prefs::kStaticEncodings, | |
474 IDS_STATIC_ENCODING_LIST); | |
475 } | |
476 | |
477 bool TabContents::OnMessageReceived(const IPC::Message& message) { | 413 bool TabContents::OnMessageReceived(const IPC::Message& message) { |
478 ObserverListBase<TabContentsObserver>::Iterator it(observers_); | 414 ObserverListBase<TabContentsObserver>::Iterator it(observers_); |
479 TabContentsObserver* observer; | 415 TabContentsObserver* observer; |
480 while ((observer = it.GetNext()) != NULL) | 416 while ((observer = it.GetNext()) != NULL) |
481 if (observer->OnMessageReceived(message)) | 417 if (observer->OnMessageReceived(message)) |
482 return true; | 418 return true; |
483 | 419 |
484 bool handled = true; | 420 bool handled = true; |
485 bool message_is_ok = true; | 421 bool message_is_ok = true; |
486 IPC_BEGIN_MESSAGE_MAP_EX(TabContents, message, message_is_ok) | 422 IPC_BEGIN_MESSAGE_MAP_EX(TabContents, message, message_is_ok) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 // keep the old page's title until the new load has committed and we get a new | 541 // keep the old page's title until the new load has committed and we get a new |
606 // title. | 542 // title. |
607 entry = controller_.GetLastCommittedEntry(); | 543 entry = controller_.GetLastCommittedEntry(); |
608 if (entry) { | 544 if (entry) { |
609 return entry->GetTitleForDisplay(profile()->GetPrefs()-> | 545 return entry->GetTitleForDisplay(profile()->GetPrefs()-> |
610 GetString(prefs::kAcceptLanguages)); | 546 GetString(prefs::kAcceptLanguages)); |
611 } | 547 } |
612 return EmptyString16(); | 548 return EmptyString16(); |
613 } | 549 } |
614 | 550 |
615 // static | |
616 string16 TabContents::GetDefaultTitle() { | |
617 return l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE); | |
618 } | |
619 | |
620 int32 TabContents::GetMaxPageID() { | 551 int32 TabContents::GetMaxPageID() { |
621 if (GetSiteInstance()) | 552 if (GetSiteInstance()) |
622 return GetSiteInstance()->max_page_id(); | 553 return GetSiteInstance()->max_page_id(); |
623 else | 554 else |
624 return max_page_id_; | 555 return max_page_id_; |
625 } | 556 } |
626 | 557 |
627 void TabContents::UpdateMaxPageID(int32 page_id) { | 558 void TabContents::UpdateMaxPageID(int32 page_id) { |
628 // Ensure both the SiteInstance and RenderProcessHost update their max page | 559 // Ensure both the SiteInstance and RenderProcessHost update their max page |
629 // IDs in sync. Only TabContents will also have site instances, except during | 560 // IDs in sync. Only TabContents will also have site instances, except during |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 // Always display a throbber during pending loads. | 615 // Always display a throbber during pending loads. |
685 if (controller_.GetLastCommittedEntry() && controller_.pending_entry()) | 616 if (controller_.GetLastCommittedEntry() && controller_.pending_entry()) |
686 return true; | 617 return true; |
687 | 618 |
688 WebUI* web_ui = GetWebUIForCurrentState(); | 619 WebUI* web_ui = GetWebUIForCurrentState(); |
689 if (web_ui) | 620 if (web_ui) |
690 return !web_ui->hide_favicon(); | 621 return !web_ui->hide_favicon(); |
691 return true; | 622 return true; |
692 } | 623 } |
693 | 624 |
694 string16 TabContents::GetStatusText() const { | |
695 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) | |
696 return string16(); | |
697 | |
698 switch (load_state_) { | |
699 case net::LOAD_STATE_WAITING_FOR_CACHE: | |
700 return l10n_util::GetStringUTF16(IDS_LOAD_STATE_WAITING_FOR_CACHE); | |
701 case net::LOAD_STATE_ESTABLISHING_PROXY_TUNNEL: | |
702 return | |
703 l10n_util::GetStringUTF16(IDS_LOAD_STATE_ESTABLISHING_PROXY_TUNNEL); | |
704 case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL: | |
705 return l10n_util::GetStringUTF16(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL); | |
706 case net::LOAD_STATE_RESOLVING_HOST: | |
707 return l10n_util::GetStringUTF16(IDS_LOAD_STATE_RESOLVING_HOST); | |
708 case net::LOAD_STATE_CONNECTING: | |
709 return l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING); | |
710 case net::LOAD_STATE_SSL_HANDSHAKE: | |
711 return l10n_util::GetStringUTF16(IDS_LOAD_STATE_SSL_HANDSHAKE); | |
712 case net::LOAD_STATE_SENDING_REQUEST: | |
713 if (upload_size_) | |
714 return l10n_util::GetStringFUTF16Int( | |
715 IDS_LOAD_STATE_SENDING_REQUEST_WITH_PROGRESS, | |
716 static_cast<int>((100 * upload_position_) / upload_size_)); | |
717 else | |
718 return l10n_util::GetStringUTF16(IDS_LOAD_STATE_SENDING_REQUEST); | |
719 case net::LOAD_STATE_WAITING_FOR_RESPONSE: | |
720 return l10n_util::GetStringFUTF16(IDS_LOAD_STATE_WAITING_FOR_RESPONSE, | |
721 load_state_host_); | |
722 // Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE | |
723 case net::LOAD_STATE_IDLE: | |
724 case net::LOAD_STATE_READING_RESPONSE: | |
725 break; | |
726 } | |
727 | |
728 return string16(); | |
729 } | |
730 | |
731 void TabContents::AddObserver(TabContentsObserver* observer) { | 625 void TabContents::AddObserver(TabContentsObserver* observer) { |
732 observers_.AddObserver(observer); | 626 observers_.AddObserver(observer); |
733 } | 627 } |
734 | 628 |
735 void TabContents::RemoveObserver(TabContentsObserver* observer) { | 629 void TabContents::RemoveObserver(TabContentsObserver* observer) { |
736 observers_.RemoveObserver(observer); | 630 observers_.RemoveObserver(observer); |
737 } | 631 } |
738 | 632 |
739 void TabContents::SetIsCrashed(base::TerminationStatus status, int error_code) { | 633 void TabContents::SetIsCrashed(base::TerminationStatus status, int error_code) { |
740 if (status == crashed_status_) | 634 if (status == crashed_status_) |
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 ExternalProtocolHandler::PermitLaunchUrl(); | 2528 ExternalProtocolHandler::PermitLaunchUrl(); |
2635 } | 2529 } |
2636 | 2530 |
2637 void TabContents::OnIgnoredUIEvent() { | 2531 void TabContents::OnIgnoredUIEvent() { |
2638 if (constrained_window_count()) { | 2532 if (constrained_window_count()) { |
2639 ConstrainedWindow* window = *constrained_window_begin(); | 2533 ConstrainedWindow* window = *constrained_window_begin(); |
2640 window->FocusConstrainedWindow(); | 2534 window->FocusConstrainedWindow(); |
2641 } | 2535 } |
2642 } | 2536 } |
2643 | 2537 |
2644 void TabContents::OnJSOutOfMemory() { | |
2645 AddInfoBar(new SimpleAlertInfoBarDelegate(this, NULL, | |
2646 l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true)); | |
2647 } | |
2648 | |
2649 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, | 2538 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, |
2650 int new_request_id) { | 2539 int new_request_id) { |
2651 // Allows the TabContents to react when a cross-site response is ready to be | 2540 // Allows the TabContents to react when a cross-site response is ready to be |
2652 // delivered to a pending RenderViewHost. We must first run the onunload | 2541 // delivered to a pending RenderViewHost. We must first run the onunload |
2653 // handler of the old RenderViewHost before we can allow it to proceed. | 2542 // handler of the old RenderViewHost before we can allow it to proceed. |
2654 render_manager_.OnCrossSiteResponse(new_render_process_host_id, | 2543 render_manager_.OnCrossSiteResponse(new_render_process_host_id, |
2655 new_request_id); | 2544 new_request_id); |
2656 } | 2545 } |
2657 | 2546 |
2658 void TabContents::RendererUnresponsive(RenderViewHost* rvh, | 2547 void TabContents::RendererUnresponsive(RenderViewHost* rvh, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2721 | 2610 |
2722 void TabContents::UpdateZoomLimits(int minimum_percent, | 2611 void TabContents::UpdateZoomLimits(int minimum_percent, |
2723 int maximum_percent, | 2612 int maximum_percent, |
2724 bool remember) { | 2613 bool remember) { |
2725 minimum_zoom_percent_ = minimum_percent; | 2614 minimum_zoom_percent_ = minimum_percent; |
2726 maximum_zoom_percent_ = maximum_percent; | 2615 maximum_zoom_percent_ = maximum_percent; |
2727 temporary_zoom_settings_ = !remember; | 2616 temporary_zoom_settings_ = !remember; |
2728 } | 2617 } |
2729 | 2618 |
2730 void TabContents::WorkerCrashed() { | 2619 void TabContents::WorkerCrashed() { |
2731 AddInfoBar(new SimpleAlertInfoBarDelegate(this, NULL, | 2620 if (delegate()) |
2732 l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT), true)); | 2621 delegate()->WorkerCrashed(); |
2733 } | 2622 } |
2734 | 2623 |
2735 void TabContents::BeforeUnloadFiredFromRenderManager( | 2624 void TabContents::BeforeUnloadFiredFromRenderManager( |
2736 bool proceed, | 2625 bool proceed, |
2737 bool* proceed_to_fire_unload) { | 2626 bool* proceed_to_fire_unload) { |
2738 if (delegate()) | 2627 if (delegate()) |
2739 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); | 2628 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); |
2740 } | 2629 } |
2741 | 2630 |
2742 void TabContents::DidStartLoadingFromRenderManager( | 2631 void TabContents::DidStartLoadingFromRenderManager( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2953 } | 2842 } |
2954 | 2843 |
2955 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { | 2844 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { |
2956 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); | 2845 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); |
2957 if (pm != NULL) { | 2846 if (pm != NULL) { |
2958 if (pm->MaybeUsePreloadedPage(this, url)) | 2847 if (pm->MaybeUsePreloadedPage(this, url)) |
2959 return true; | 2848 return true; |
2960 } | 2849 } |
2961 return false; | 2850 return false; |
2962 } | 2851 } |
OLD | NEW |