OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2060 const string16& message, | 2060 const string16& message, |
2061 IPC::Message* reply_msg) { | 2061 IPC::Message* reply_msg) { |
2062 if (delegate_) | 2062 if (delegate_) |
2063 delegate_->WillRunBeforeUnloadConfirm(); | 2063 delegate_->WillRunBeforeUnloadConfirm(); |
2064 | 2064 |
2065 bool suppress_this_message = | 2065 bool suppress_this_message = |
2066 rvh->is_swapped_out() || | 2066 rvh->is_swapped_out() || |
2067 !delegate_ || | 2067 !delegate_ || |
2068 delegate_->ShouldSuppressDialogs(); | 2068 delegate_->ShouldSuppressDialogs(); |
2069 if (suppress_this_message) { | 2069 if (suppress_this_message) { |
2070 // TODO(creis): We need to send this reply to the RVH that sent the request, | |
2071 // even if it's not the current RVH. http;//crbug.com/109792. | |
2070 GetRenderViewHost()->JavaScriptDialogClosed(reply_msg, true, string16()); | 2072 GetRenderViewHost()->JavaScriptDialogClosed(reply_msg, true, string16()); |
Matt Perry
2012/01/27 19:38:13
Isn't |rvh| the RVH that sent the request?
Charlie Reis
2012/01/27 20:11:30
Done.
| |
2071 return; | 2073 return; |
2072 } | 2074 } |
2073 | 2075 |
2074 is_showing_before_unload_dialog_ = true; | 2076 is_showing_before_unload_dialog_ = true; |
2075 dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); | 2077 dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); |
2076 dialog_creator_->RunBeforeUnloadDialog(this, | 2078 dialog_creator_->RunBeforeUnloadDialog(this, |
2077 message, | 2079 message, |
2078 reply_msg); | 2080 reply_msg); |
2079 } | 2081 } |
2080 | 2082 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2257 bool success, | 2259 bool success, |
2258 const string16& user_input) { | 2260 const string16& user_input) { |
2259 if (is_showing_before_unload_dialog_ && !success) { | 2261 if (is_showing_before_unload_dialog_ && !success) { |
2260 // If a beforeunload dialog is canceled, we need to stop the throbber from | 2262 // If a beforeunload dialog is canceled, we need to stop the throbber from |
2261 // spinning, since we forced it to start spinning in Navigate. | 2263 // spinning, since we forced it to start spinning in Navigate. |
2262 DidStopLoading(); | 2264 DidStopLoading(); |
2263 | 2265 |
2264 tab_close_start_time_ = base::TimeTicks(); | 2266 tab_close_start_time_ = base::TimeTicks(); |
2265 } | 2267 } |
2266 is_showing_before_unload_dialog_ = false; | 2268 is_showing_before_unload_dialog_ = false; |
2269 // TODO(creis): We need to send this reply to the RVH that sent the request, | |
2270 // even if it's not the current RVH. http;//crbug.com/109792. | |
2267 GetRenderViewHost()->JavaScriptDialogClosed(reply_msg, success, user_input); | 2271 GetRenderViewHost()->JavaScriptDialogClosed(reply_msg, success, user_input); |
2268 } | 2272 } |
2269 | 2273 |
2270 gfx::NativeWindow TabContents::GetDialogRootWindow() const { | 2274 gfx::NativeWindow TabContents::GetDialogRootWindow() const { |
2271 return view_->GetTopLevelNativeWindow(); | 2275 return view_->GetTopLevelNativeWindow(); |
2272 } | 2276 } |
2273 | 2277 |
2274 void TabContents::OnDialogShown() { | 2278 void TabContents::OnDialogShown() { |
2275 Activate(); | 2279 Activate(); |
2276 } | 2280 } |
2277 | 2281 |
2278 void TabContents::SetEncoding(const std::string& encoding) { | 2282 void TabContents::SetEncoding(const std::string& encoding) { |
2279 encoding_ = content::GetContentClient()->browser()-> | 2283 encoding_ = content::GetContentClient()->browser()-> |
2280 GetCanonicalEncodingNameByAliasName(encoding); | 2284 GetCanonicalEncodingNameByAliasName(encoding); |
2281 } | 2285 } |
2282 | 2286 |
2283 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2287 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2284 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2288 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2285 // Can be NULL during tests. | 2289 // Can be NULL during tests. |
2286 if (rwh_view) | 2290 if (rwh_view) |
2287 rwh_view->SetSize(GetView()->GetContainerSize()); | 2291 rwh_view->SetSize(GetView()->GetContainerSize()); |
2288 } | 2292 } |
OLD | NEW |