| 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 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/browser/file_select_helper.h" | 34 #include "chrome/browser/file_select_helper.h" |
| 35 #include "chrome/browser/google/google_util.h" | 35 #include "chrome/browser/google/google_util.h" |
| 36 #include "chrome/browser/history/history.h" | 36 #include "chrome/browser/history/history.h" |
| 37 #include "chrome/browser/history/history_types.h" | 37 #include "chrome/browser/history/history_types.h" |
| 38 #include "chrome/browser/history/top_sites.h" | 38 #include "chrome/browser/history/top_sites.h" |
| 39 #include "chrome/browser/hung_renderer_dialog.h" | 39 #include "chrome/browser/hung_renderer_dialog.h" |
| 40 #include "chrome/browser/load_from_memory_cache_details.h" | 40 #include "chrome/browser/load_from_memory_cache_details.h" |
| 41 #include "chrome/browser/load_notification_details.h" | 41 #include "chrome/browser/load_notification_details.h" |
| 42 #include "chrome/browser/metrics/metric_event_duration_details.h" | 42 #include "chrome/browser/metrics/metric_event_duration_details.h" |
| 43 #include "chrome/browser/metrics/user_metrics.h" | 43 #include "chrome/browser/metrics/user_metrics.h" |
| 44 #include "chrome/browser/modal_html_dialog_delegate.h" | |
| 45 #include "chrome/browser/omnibox_search_hint.h" | 44 #include "chrome/browser/omnibox_search_hint.h" |
| 46 #include "chrome/browser/pdf_unsupported_feature.h" | 45 #include "chrome/browser/pdf_unsupported_feature.h" |
| 47 #include "chrome/browser/platform_util.h" | 46 #include "chrome/browser/platform_util.h" |
| 48 #include "chrome/browser/plugin_observer.h" | 47 #include "chrome/browser/plugin_observer.h" |
| 49 #include "chrome/browser/prerender/prerender_manager.h" | 48 #include "chrome/browser/prerender/prerender_manager.h" |
| 50 #include "chrome/browser/prerender/prerender_plt_recorder.h" | 49 #include "chrome/browser/prerender/prerender_plt_recorder.h" |
| 51 #include "chrome/browser/printing/print_preview_message_handler.h" | 50 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 52 #include "chrome/browser/printing/print_preview_tab_controller.h" | 51 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 53 #include "chrome/browser/printing/print_view_manager.h" | 52 #include "chrome/browser/printing/print_view_manager.h" |
| 54 #include "chrome/browser/profiles/profile.h" | 53 #include "chrome/browser/profiles/profile.h" |
| (...skipping 2409 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 } | 2833 } |
| 2846 | 2834 |
| 2847 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { | 2835 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { |
| 2848 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); | 2836 prerender::PrerenderManager* pm = profile()->GetPrerenderManager(); |
| 2849 if (pm != NULL) { | 2837 if (pm != NULL) { |
| 2850 if (pm->MaybeUsePreloadedPage(this, url)) | 2838 if (pm->MaybeUsePreloadedPage(this, url)) |
| 2851 return true; | 2839 return true; |
| 2852 } | 2840 } |
| 2853 return false; | 2841 return false; |
| 2854 } | 2842 } |
| OLD | NEW |