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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 // If we still have a window handle, destroy it. GetNativeView can return | 339 // If we still have a window handle, destroy it. GetNativeView can return |
340 // NULL if this contents was part of a window that closed. | 340 // NULL if this contents was part of a window that closed. |
341 if (GetNativeView()) { | 341 if (GetNativeView()) { |
342 RenderViewHost* host = GetRenderViewHost(); | 342 RenderViewHost* host = GetRenderViewHost(); |
343 if (host && host->GetView()) | 343 if (host && host->GetView()) |
344 RenderWidgetHostViewPort::FromRWHV(host->GetView())->WillWmDestroy(); | 344 RenderWidgetHostViewPort::FromRWHV(host->GetView())->WillWmDestroy(); |
345 } | 345 } |
346 #endif | 346 #endif |
347 | 347 |
348 // OnCloseStarted isn't called in unit tests. | 348 // OnCloseStarted isn't called in unit tests. |
349 if (!tab_close_start_time_.is_null()) { | 349 if (!close_start_time_.is_null()) { |
350 UMA_HISTOGRAM_TIMES("Tab.Close", | 350 UMA_HISTOGRAM_TIMES("Tab.Close", |
351 base::TimeTicks::Now() - tab_close_start_time_); | 351 base::TimeTicks::Now() - close_start_time_); |
352 } | 352 } |
353 | 353 |
354 FOR_EACH_OBSERVER(WebContentsObserver, | 354 FOR_EACH_OBSERVER(WebContentsObserver, |
355 observers_, | 355 observers_, |
356 WebContentsImplDestroyed()); | 356 WebContentsImplDestroyed()); |
357 | 357 |
358 SetDelegate(NULL); | 358 SetDelegate(NULL); |
359 } | 359 } |
360 | 360 |
361 WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh, | 361 WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh, |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 | 1243 |
1244 void WebContentsImpl::SetNewTabStartTime(const base::TimeTicks& time) { | 1244 void WebContentsImpl::SetNewTabStartTime(const base::TimeTicks& time) { |
1245 new_tab_start_time_ = time; | 1245 new_tab_start_time_ = time; |
1246 } | 1246 } |
1247 | 1247 |
1248 base::TimeTicks WebContentsImpl::GetNewTabStartTime() const { | 1248 base::TimeTicks WebContentsImpl::GetNewTabStartTime() const { |
1249 return new_tab_start_time_; | 1249 return new_tab_start_time_; |
1250 } | 1250 } |
1251 | 1251 |
1252 void WebContentsImpl::OnCloseStarted() { | 1252 void WebContentsImpl::OnCloseStarted() { |
1253 if (tab_close_start_time_.is_null()) | 1253 if (close_start_time_.is_null()) |
1254 tab_close_start_time_ = base::TimeTicks::Now(); | 1254 close_start_time_ = base::TimeTicks::Now(); |
1255 } | 1255 } |
1256 | 1256 |
1257 bool WebContentsImpl::ShouldAcceptDragAndDrop() const { | 1257 bool WebContentsImpl::ShouldAcceptDragAndDrop() const { |
1258 #if defined(OS_CHROMEOS) | 1258 #if defined(OS_CHROMEOS) |
1259 // ChromeOS panels (pop-ups) do not take drag-n-drop. | 1259 // ChromeOS panels (pop-ups) do not take drag-n-drop. |
1260 // See http://crosbug.com/2413 | 1260 // See http://crosbug.com/2413 |
1261 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 1261 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
1262 return false; | 1262 return false; |
1263 return true; | 1263 return true; |
1264 #else | 1264 #else |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 | 2577 |
2578 void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, | 2578 void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, |
2579 IPC::Message* reply_msg, | 2579 IPC::Message* reply_msg, |
2580 bool success, | 2580 bool success, |
2581 const string16& user_input) { | 2581 const string16& user_input) { |
2582 if (is_showing_before_unload_dialog_ && !success) { | 2582 if (is_showing_before_unload_dialog_ && !success) { |
2583 // If a beforeunload dialog is canceled, we need to stop the throbber from | 2583 // If a beforeunload dialog is canceled, we need to stop the throbber from |
2584 // spinning, since we forced it to start spinning in Navigate. | 2584 // spinning, since we forced it to start spinning in Navigate. |
2585 DidStopLoading(); | 2585 DidStopLoading(); |
2586 | 2586 |
2587 tab_close_start_time_ = base::TimeTicks(); | 2587 close_start_time_ = base::TimeTicks(); |
2588 } | 2588 } |
2589 is_showing_before_unload_dialog_ = false; | 2589 is_showing_before_unload_dialog_ = false; |
2590 static_cast<RenderViewHostImpl*>( | 2590 static_cast<RenderViewHostImpl*>( |
2591 rvh)->JavaScriptDialogClosed(reply_msg, success, user_input); | 2591 rvh)->JavaScriptDialogClosed(reply_msg, success, user_input); |
2592 } | 2592 } |
2593 | 2593 |
2594 void WebContentsImpl::SetEncoding(const std::string& encoding) { | 2594 void WebContentsImpl::SetEncoding(const std::string& encoding) { |
2595 encoding_ = content::GetContentClient()->browser()-> | 2595 encoding_ = content::GetContentClient()->browser()-> |
2596 GetCanonicalEncodingNameByAliasName(encoding); | 2596 GetCanonicalEncodingNameByAliasName(encoding); |
2597 } | 2597 } |
(...skipping 25 matching lines...) Expand all Loading... |
2623 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2623 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2624 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2624 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2625 // Can be NULL during tests. | 2625 // Can be NULL during tests. |
2626 if (rwh_view) | 2626 if (rwh_view) |
2627 rwh_view->SetSize(GetView()->GetContainerSize()); | 2627 rwh_view->SetSize(GetView()->GetContainerSize()); |
2628 } | 2628 } |
2629 | 2629 |
2630 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2630 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2631 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2631 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2632 } | 2632 } |
OLD | NEW |