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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 } | 1299 } |
1300 | 1300 |
1301 void WebContentsImpl::SetNewTabStartTime(const base::TimeTicks& time) { | 1301 void WebContentsImpl::SetNewTabStartTime(const base::TimeTicks& time) { |
1302 new_tab_start_time_ = time; | 1302 new_tab_start_time_ = time; |
1303 } | 1303 } |
1304 | 1304 |
1305 base::TimeTicks WebContentsImpl::GetNewTabStartTime() const { | 1305 base::TimeTicks WebContentsImpl::GetNewTabStartTime() const { |
1306 return new_tab_start_time_; | 1306 return new_tab_start_time_; |
1307 } | 1307 } |
1308 | 1308 |
| 1309 void WebContentsImpl::Close() { |
| 1310 Close(GetRenderViewHost()); |
| 1311 } |
| 1312 |
1309 void WebContentsImpl::OnCloseStarted() { | 1313 void WebContentsImpl::OnCloseStarted() { |
1310 if (close_start_time_.is_null()) | 1314 if (close_start_time_.is_null()) |
1311 close_start_time_ = base::TimeTicks::Now(); | 1315 close_start_time_ = base::TimeTicks::Now(); |
1312 } | 1316 } |
1313 | 1317 |
1314 bool WebContentsImpl::ShouldAcceptDragAndDrop() const { | 1318 bool WebContentsImpl::ShouldAcceptDragAndDrop() const { |
1315 #if defined(OS_CHROMEOS) | 1319 #if defined(OS_CHROMEOS) |
1316 // ChromeOS panels (pop-ups) do not take drag-n-drop. | 1320 // ChromeOS panels (pop-ups) do not take drag-n-drop. |
1317 // See http://crosbug.com/2413 | 1321 // See http://crosbug.com/2413 |
1318 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 1322 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
1319 return false; | 1323 return false; |
1320 return true; | 1324 return true; |
1321 #else | 1325 #else |
1322 return true; | 1326 return true; |
1323 #endif | 1327 #endif |
1324 } | 1328 } |
1325 | 1329 |
1326 void WebContentsImpl::SystemDragEnded() { | 1330 void WebContentsImpl::SystemDragEnded() { |
1327 if (GetRenderViewHost()) | 1331 if (GetRenderViewHost()) |
1328 GetRenderViewHostImpl()->DragSourceSystemDragEnded(); | 1332 GetRenderViewHostImpl()->DragSourceSystemDragEnded(); |
1329 if (delegate_) | 1333 if (delegate_) |
1330 delegate_->DragEnded(); | 1334 delegate_->DragEnded(); |
1331 } | 1335 } |
1332 | 1336 |
| 1337 void WebContentsImpl::UserGestureDone() { |
| 1338 OnUserGesture(); |
| 1339 } |
| 1340 |
1333 void WebContentsImpl::SetClosedByUserGesture(bool value) { | 1341 void WebContentsImpl::SetClosedByUserGesture(bool value) { |
1334 closed_by_user_gesture_ = value; | 1342 closed_by_user_gesture_ = value; |
1335 } | 1343 } |
1336 | 1344 |
1337 bool WebContentsImpl::GetClosedByUserGesture() const { | 1345 bool WebContentsImpl::GetClosedByUserGesture() const { |
1338 return closed_by_user_gesture_; | 1346 return closed_by_user_gesture_; |
1339 } | 1347 } |
1340 | 1348 |
1341 double WebContentsImpl::GetZoomLevel() const { | 1349 double WebContentsImpl::GetZoomLevel() const { |
1342 HostZoomMapImpl* zoom_map = static_cast<HostZoomMapImpl*>( | 1350 HostZoomMapImpl* zoom_map = static_cast<HostZoomMapImpl*>( |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2797 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2805 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2798 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2806 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2799 // Can be NULL during tests. | 2807 // Can be NULL during tests. |
2800 if (rwh_view) | 2808 if (rwh_view) |
2801 rwh_view->SetSize(GetView()->GetContainerSize()); | 2809 rwh_view->SetSize(GetView()->GetContainerSize()); |
2802 } | 2810 } |
2803 | 2811 |
2804 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2812 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2805 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2813 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2806 } | 2814 } |
OLD | NEW |