| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
| 46 #include "chrome/browser/renderer_host/web_cache_manager.h" | 46 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| 47 #include "chrome/browser/renderer_preferences_util.h" | 47 #include "chrome/browser/renderer_preferences_util.h" |
| 48 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 48 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
| 49 #include "chrome/browser/sessions/session_types.h" | 49 #include "chrome/browser/sessions/session_types.h" |
| 50 #include "chrome/browser/tab_contents/infobar_delegate.h" | 50 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 51 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 51 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
| 52 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 52 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 53 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 53 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 54 #include "chrome/browser/ui/browser_dialogs.h" | 54 #include "chrome/browser/ui/browser_dialogs.h" |
| 55 #include "chrome/common/bindings_policy.h" | |
| 56 #include "chrome/common/chrome_constants.h" | 55 #include "chrome/common/chrome_constants.h" |
| 57 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/content_restriction.h" | 57 #include "chrome/common/content_restriction.h" |
| 59 #include "chrome/common/extensions/extension.h" | 58 #include "chrome/common/extensions/extension.h" |
| 60 #include "chrome/common/extensions/extension_messages.h" | 59 #include "chrome/common/extensions/extension_messages.h" |
| 61 #include "chrome/common/extensions/url_pattern.h" | 60 #include "chrome/common/extensions/url_pattern.h" |
| 62 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
| 63 #include "chrome/common/render_messages.h" | 62 #include "chrome/common/render_messages.h" |
| 64 #include "chrome/common/url_constants.h" | 63 #include "chrome/common/url_constants.h" |
| 65 #include "content/browser/child_process_security_policy.h" | 64 #include "content/browser/child_process_security_policy.h" |
| 66 #include "content/browser/content_browser_client.h" | 65 #include "content/browser/content_browser_client.h" |
| 67 #include "content/browser/host_zoom_map.h" | 66 #include "content/browser/host_zoom_map.h" |
| 68 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 67 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 69 #include "content/browser/renderer_host/render_process_host.h" | 68 #include "content/browser/renderer_host/render_process_host.h" |
| 70 #include "content/browser/renderer_host/render_view_host.h" | 69 #include "content/browser/renderer_host/render_view_host.h" |
| 71 #include "content/browser/renderer_host/render_widget_host_view.h" | 70 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 72 #include "content/browser/renderer_host/resource_request_details.h" | 71 #include "content/browser/renderer_host/resource_request_details.h" |
| 73 #include "content/browser/site_instance.h" | 72 #include "content/browser/site_instance.h" |
| 74 #include "content/browser/tab_contents/interstitial_page.h" | 73 #include "content/browser/tab_contents/interstitial_page.h" |
| 75 #include "content/browser/tab_contents/navigation_entry.h" | 74 #include "content/browser/tab_contents/navigation_entry.h" |
| 76 #include "content/browser/tab_contents/provisional_load_details.h" | 75 #include "content/browser/tab_contents/provisional_load_details.h" |
| 77 #include "content/browser/tab_contents/tab_contents_delegate.h" | 76 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 78 #include "content/browser/tab_contents/tab_contents_observer.h" | 77 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 79 #include "content/browser/tab_contents/tab_contents_view.h" | 78 #include "content/browser/tab_contents/tab_contents_view.h" |
| 80 #include "content/browser/webui/web_ui_factory.h" | 79 #include "content/browser/webui/web_ui_factory.h" |
| 80 #include "content/common/bindings_policy.h" |
| 81 #include "content/common/content_client.h" | 81 #include "content/common/content_client.h" |
| 82 #include "content/common/navigation_types.h" | 82 #include "content/common/navigation_types.h" |
| 83 #include "content/common/notification_service.h" | 83 #include "content/common/notification_service.h" |
| 84 #include "content/common/view_messages.h" | 84 #include "content/common/view_messages.h" |
| 85 #include "net/base/net_util.h" | 85 #include "net/base/net_util.h" |
| 86 #include "net/base/registry_controlled_domain.h" | 86 #include "net/base/registry_controlled_domain.h" |
| 87 #include "net/url_request/url_request_context_getter.h" | 87 #include "net/url_request/url_request_context_getter.h" |
| 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 88 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 89 #include "ui/base/resource/resource_bundle.h" | 89 #include "ui/base/resource/resource_bundle.h" |
| 90 #include "ui/gfx/codec/png_codec.h" | 90 #include "ui/gfx/codec/png_codec.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 233 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 234 crashed_error_code_(0), | 234 crashed_error_code_(0), |
| 235 waiting_for_response_(false), | 235 waiting_for_response_(false), |
| 236 max_page_id_(-1), | 236 max_page_id_(-1), |
| 237 load_state_(net::LOAD_STATE_IDLE), | 237 load_state_(net::LOAD_STATE_IDLE), |
| 238 upload_size_(0), | 238 upload_size_(0), |
| 239 upload_position_(0), | 239 upload_position_(0), |
| 240 received_page_title_(false), | 240 received_page_title_(false), |
| 241 blocked_contents_(NULL), | 241 blocked_contents_(NULL), |
| 242 all_contents_blocked_(false), | 242 all_contents_blocked_(false), |
| 243 dont_notify_render_view_(false), | |
| 244 displayed_insecure_content_(false), | 243 displayed_insecure_content_(false), |
| 245 capturing_contents_(false), | 244 capturing_contents_(false), |
| 246 is_being_destroyed_(false), | 245 is_being_destroyed_(false), |
| 247 notify_disconnection_(false), | 246 notify_disconnection_(false), |
| 248 #if defined(OS_WIN) | 247 #if defined(OS_WIN) |
| 249 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), | 248 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), |
| 250 #endif | 249 #endif |
| 251 suppress_javascript_messages_(false), | 250 suppress_javascript_messages_(false), |
| 252 is_showing_before_unload_dialog_(false), | 251 is_showing_before_unload_dialog_(false), |
| 253 opener_web_ui_type_(WebUI::kNoWebUI), | 252 opener_web_ui_type_(WebUI::kNoWebUI), |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 843 } |
| 845 | 844 |
| 846 // TODO(pkasting): Why is this necessary? | 845 // TODO(pkasting): Why is this necessary? |
| 847 PopupNotificationVisibilityChanged(blocked_contents_ != NULL); | 846 PopupNotificationVisibilityChanged(blocked_contents_ != NULL); |
| 848 } | 847 } |
| 849 | 848 |
| 850 void TabContents::PopupNotificationVisibilityChanged(bool visible) { | 849 void TabContents::PopupNotificationVisibilityChanged(bool visible) { |
| 851 if (is_being_destroyed_) | 850 if (is_being_destroyed_) |
| 852 return; | 851 return; |
| 853 content_settings_delegate_->SetPopupsBlocked(visible); | 852 content_settings_delegate_->SetPopupsBlocked(visible); |
| 854 if (!dont_notify_render_view_) | |
| 855 render_view_host()->AllowScriptToClose(!visible); | |
| 856 } | 853 } |
| 857 | 854 |
| 858 gfx::NativeView TabContents::GetContentNativeView() const { | 855 gfx::NativeView TabContents::GetContentNativeView() const { |
| 859 return view_->GetContentNativeView(); | 856 return view_->GetContentNativeView(); |
| 860 } | 857 } |
| 861 | 858 |
| 862 gfx::NativeView TabContents::GetNativeView() const { | 859 gfx::NativeView TabContents::GetNativeView() const { |
| 863 return view_->GetNativeView(); | 860 return view_->GetNativeView(); |
| 864 } | 861 } |
| 865 | 862 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 favicon_helper_->FetchFavicon(details.entry->url()); | 1529 favicon_helper_->FetchFavicon(details.entry->url()); |
| 1533 | 1530 |
| 1534 if (touch_icon_helper_.get()) | 1531 if (touch_icon_helper_.get()) |
| 1535 touch_icon_helper_->FetchFavicon(details.entry->url()); | 1532 touch_icon_helper_->FetchFavicon(details.entry->url()); |
| 1536 | 1533 |
| 1537 // Clear all page actions, blocked content notifications and browser actions | 1534 // Clear all page actions, blocked content notifications and browser actions |
| 1538 // for this tab, unless this is an in-page navigation. | 1535 // for this tab, unless this is an in-page navigation. |
| 1539 if (!details.is_in_page) { | 1536 if (!details.is_in_page) { |
| 1540 // Close blocked popups. | 1537 // Close blocked popups. |
| 1541 if (blocked_contents_) { | 1538 if (blocked_contents_) { |
| 1542 AutoReset<bool> auto_reset(&dont_notify_render_view_, true); | |
| 1543 blocked_contents_->Destroy(); | 1539 blocked_contents_->Destroy(); |
| 1544 blocked_contents_ = NULL; | 1540 blocked_contents_ = NULL; |
| 1545 } | 1541 } |
| 1546 | 1542 |
| 1547 // Clear "blocked" flags. | 1543 // Clear "blocked" flags. |
| 1548 content_settings_delegate_->ClearBlockedContentSettingsExceptForCookies(); | 1544 content_settings_delegate_->ClearBlockedContentSettingsExceptForCookies(); |
| 1549 content_settings_delegate_->GeolocationDidNavigate(details); | 1545 content_settings_delegate_->GeolocationDidNavigate(details); |
| 1550 | 1546 |
| 1551 // Once the main frame is navigated, we're no longer considered to have | 1547 // Once the main frame is navigated, we're no longer considered to have |
| 1552 // displayed insecure content. | 1548 // displayed insecure content. |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2529 | 2525 |
| 2530 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2526 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2531 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2527 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2532 rwh_view->SetSize(view()->GetContainerSize()); | 2528 rwh_view->SetSize(view()->GetContainerSize()); |
| 2533 } | 2529 } |
| 2534 | 2530 |
| 2535 void TabContents::OnOnlineStateChanged(bool online) { | 2531 void TabContents::OnOnlineStateChanged(bool online) { |
| 2536 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2532 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2537 render_view_host()->routing_id(), online)); | 2533 render_view_host()->routing_id(), online)); |
| 2538 } | 2534 } |
| OLD | NEW |