| 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" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "chrome/common/extensions/url_pattern.h" | 68 #include "chrome/common/extensions/url_pattern.h" |
| 69 #include "chrome/common/navigation_types.h" | 69 #include "chrome/common/navigation_types.h" |
| 70 #include "chrome/common/net/url_request_context_getter.h" | 70 #include "chrome/common/net/url_request_context_getter.h" |
| 71 #include "chrome/common/pref_names.h" | 71 #include "chrome/common/pref_names.h" |
| 72 #include "chrome/common/render_messages.h" | 72 #include "chrome/common/render_messages.h" |
| 73 #include "chrome/common/render_messages_params.h" | 73 #include "chrome/common/render_messages_params.h" |
| 74 #include "chrome/common/url_constants.h" | 74 #include "chrome/common/url_constants.h" |
| 75 #include "content/browser/child_process_security_policy.h" | 75 #include "content/browser/child_process_security_policy.h" |
| 76 #include "content/browser/host_zoom_map.h" | 76 #include "content/browser/host_zoom_map.h" |
| 77 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 77 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 78 #include "content/browser/modal_html_dialog_delegate.h" | |
| 79 #include "content/browser/renderer_host/render_process_host.h" | 78 #include "content/browser/renderer_host/render_process_host.h" |
| 80 #include "content/browser/renderer_host/render_view_host.h" | 79 #include "content/browser/renderer_host/render_view_host.h" |
| 81 #include "content/browser/renderer_host/render_widget_host_view.h" | 80 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 82 #include "content/browser/renderer_host/resource_request_details.h" | 81 #include "content/browser/renderer_host/resource_request_details.h" |
| 83 #include "content/browser/site_instance.h" | 82 #include "content/browser/site_instance.h" |
| 84 #include "content/browser/tab_contents/interstitial_page.h" | 83 #include "content/browser/tab_contents/interstitial_page.h" |
| 85 #include "content/browser/tab_contents/navigation_entry.h" | 84 #include "content/browser/tab_contents/navigation_entry.h" |
| 86 #include "content/browser/tab_contents/provisional_load_details.h" | 85 #include "content/browser/tab_contents/provisional_load_details.h" |
| 87 #include "content/browser/tab_contents/tab_contents_delegate.h" | 86 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 88 #include "content/browser/tab_contents/tab_contents_observer.h" | 87 #include "content/browser/tab_contents/tab_contents_observer.h" |
| (...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 delegate()->WillRunBeforeUnloadConfirm(); | 2463 delegate()->WillRunBeforeUnloadConfirm(); |
| 2465 if (delegate() && delegate()->ShouldSuppressDialogs()) { | 2464 if (delegate() && delegate()->ShouldSuppressDialogs()) { |
| 2466 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, | 2465 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, |
| 2467 std::wstring()); | 2466 std::wstring()); |
| 2468 return; | 2467 return; |
| 2469 } | 2468 } |
| 2470 is_showing_before_unload_dialog_ = true; | 2469 is_showing_before_unload_dialog_ = true; |
| 2471 RunBeforeUnloadDialog(this, message, reply_msg); | 2470 RunBeforeUnloadDialog(this, message, reply_msg); |
| 2472 } | 2471 } |
| 2473 | 2472 |
| 2474 void TabContents::ShowModalHTMLDialog(const GURL& url, int width, int height, | |
| 2475 const std::string& json_arguments, | |
| 2476 IPC::Message* reply_msg) { | |
| 2477 if (delegate()) { | |
| 2478 HtmlDialogUIDelegate* dialog_delegate = | |
| 2479 new ModalHtmlDialogDelegate(url, width, height, json_arguments, | |
| 2480 reply_msg, this); | |
| 2481 delegate()->ShowHtmlDialog(dialog_delegate, NULL); | |
| 2482 } | |
| 2483 } | |
| 2484 | |
| 2485 GURL TabContents::GetAlternateErrorPageURL() const { | 2473 GURL TabContents::GetAlternateErrorPageURL() const { |
| 2486 GURL url; | 2474 GURL url; |
| 2487 // Disable alternate error pages when in OffTheRecord/Incognito mode. | 2475 // Disable alternate error pages when in OffTheRecord/Incognito mode. |
| 2488 if (profile()->IsOffTheRecord()) | 2476 if (profile()->IsOffTheRecord()) |
| 2489 return url; | 2477 return url; |
| 2490 | 2478 |
| 2491 PrefService* prefs = profile()->GetPrefs(); | 2479 PrefService* prefs = profile()->GetPrefs(); |
| 2492 DCHECK(prefs); | 2480 DCHECK(prefs); |
| 2493 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) { | 2481 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) { |
| 2494 url = google_util::AppendGoogleLocaleParam( | 2482 url = google_util::AppendGoogleLocaleParam( |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2842 | 2830 |
| 2843 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2831 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2844 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2832 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 2845 rwh_view->SetSize(view()->GetContainerSize()); | 2833 rwh_view->SetSize(view()->GetContainerSize()); |
| 2846 } | 2834 } |
| 2847 | 2835 |
| 2848 void TabContents::OnOnlineStateChanged(bool online) { | 2836 void TabContents::OnOnlineStateChanged(bool online) { |
| 2849 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 2837 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
| 2850 render_view_host()->routing_id(), online)); | 2838 render_view_host()->routing_id(), online)); |
| 2851 } | 2839 } |
| OLD | NEW |