| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/tab_contents.h" | 
| 6 | 6 | 
| 7 #include <cmath> | 7 #include <cmath> | 
| 8 | 8 | 
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" | 
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" | 
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 842 void TabContents::HideContents() { | 842 void TabContents::HideContents() { | 
| 843   // TODO(pkasting): http://b/1239839  Right now we purposefully don't call | 843   // TODO(pkasting): http://b/1239839  Right now we purposefully don't call | 
| 844   // our superclass HideContents(), because some callers want to be very picky | 844   // our superclass HideContents(), because some callers want to be very picky | 
| 845   // about the order in which these get called.  In addition to making the code | 845   // about the order in which these get called.  In addition to making the code | 
| 846   // here practically impossible to understand, this also means we end up | 846   // here practically impossible to understand, this also means we end up | 
| 847   // calling TabContents::WasHidden() twice if callers call both versions of | 847   // calling TabContents::WasHidden() twice if callers call both versions of | 
| 848   // HideContents() on a TabContents. | 848   // HideContents() on a TabContents. | 
| 849   WasHidden(); | 849   WasHidden(); | 
| 850 } | 850 } | 
| 851 | 851 | 
|  | 852 bool TabContents::NeedToFireBeforeUnload() { | 
|  | 853   // TODO(creis): Should we fire even for interstitial pages? | 
|  | 854   return notify_disconnection() && | 
|  | 855       !showing_interstitial_page() && | 
|  | 856       !render_view_host()->SuddenTerminationAllowed(); | 
|  | 857 } | 
|  | 858 | 
| 852 void TabContents::OpenURL(const GURL& url, const GURL& referrer, | 859 void TabContents::OpenURL(const GURL& url, const GURL& referrer, | 
| 853                           WindowOpenDisposition disposition, | 860                           WindowOpenDisposition disposition, | 
| 854                           PageTransition::Type transition) { | 861                           PageTransition::Type transition) { | 
| 855   if (delegate_) | 862   if (delegate_) | 
| 856     delegate_->OpenURLFromTab(this, url, referrer, disposition, transition); | 863     delegate_->OpenURLFromTab(this, url, referrer, disposition, transition); | 
| 857 } | 864 } | 
| 858 | 865 | 
| 859 bool TabContents::NavigateToPendingEntry( | 866 bool TabContents::NavigateToPendingEntry( | 
| 860     NavigationController::ReloadType reload_type) { | 867     NavigationController::ReloadType reload_type) { | 
| 861   return NavigateToEntry(*controller_.pending_entry(), reload_type); | 868   return NavigateToEntry(*controller_.pending_entry(), reload_type); | 
| (...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2785                             default_prompt, show_suppress_checkbox, reply_msg); | 2792                             default_prompt, show_suppress_checkbox, reply_msg); | 
| 2786   } else { | 2793   } else { | 
| 2787     // If we are suppressing messages, just reply as is if the user immediately | 2794     // If we are suppressing messages, just reply as is if the user immediately | 
| 2788     // pressed "Cancel". | 2795     // pressed "Cancel". | 
| 2789     OnMessageBoxClosed(reply_msg, false, std::wstring()); | 2796     OnMessageBoxClosed(reply_msg, false, std::wstring()); | 
| 2790   } | 2797   } | 
| 2791 } | 2798 } | 
| 2792 | 2799 | 
| 2793 void TabContents::RunBeforeUnloadConfirm(const std::wstring& message, | 2800 void TabContents::RunBeforeUnloadConfirm(const std::wstring& message, | 
| 2794                                          IPC::Message* reply_msg) { | 2801                                          IPC::Message* reply_msg) { | 
|  | 2802   if (delegate()) | 
|  | 2803     delegate()->WillRunBeforeUnloadConfirm(); | 
| 2795   if (delegate() && delegate()->ShouldSuppressDialogs()) { | 2804   if (delegate() && delegate()->ShouldSuppressDialogs()) { | 
| 2796     render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, | 2805     render_view_host()->JavaScriptMessageBoxClosed(reply_msg, true, | 
| 2797                                                    std::wstring()); | 2806                                                    std::wstring()); | 
| 2798     return; | 2807     return; | 
| 2799   } | 2808   } | 
| 2800   is_showing_before_unload_dialog_ = true; | 2809   is_showing_before_unload_dialog_ = true; | 
| 2801   RunBeforeUnloadDialog(this, message, reply_msg); | 2810   RunBeforeUnloadDialog(this, message, reply_msg); | 
| 2802 } | 2811 } | 
| 2803 | 2812 | 
| 2804 void TabContents::ShowModalHTMLDialog(const GURL& url, int width, int height, | 2813 void TabContents::ShowModalHTMLDialog(const GURL& url, int width, int height, | 
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3251 } | 3260 } | 
| 3252 | 3261 | 
| 3253 void TabContents::set_encoding(const std::string& encoding) { | 3262 void TabContents::set_encoding(const std::string& encoding) { | 
| 3254   encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 3263   encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 
| 3255 } | 3264 } | 
| 3256 | 3265 | 
| 3257 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 3266 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 
| 3258   app_icon_ = app_icon; | 3267   app_icon_ = app_icon; | 
| 3259   NotifyNavigationStateChanged(INVALIDATE_TITLE); | 3268   NotifyNavigationStateChanged(INVALIDATE_TITLE); | 
| 3260 } | 3269 } | 
| OLD | NEW | 
|---|