| 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/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/stack_trace.h" | 14 #include "base/debug/stack_trace.h" |
| 15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 16 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
| 17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
| 19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "base/trace_event/trace_event.h" | 25 #include "base/trace_event/trace_event.h" |
| 26 #include "base/values.h" | 26 #include "base/values.h" |
| 27 #include "cc/base/switches.h" | 27 #include "cc/base/switches.h" |
| 28 #include "content/browser/bad_message.h" |
| 28 #include "content/browser/child_process_security_policy_impl.h" | 29 #include "content/browser/child_process_security_policy_impl.h" |
| 29 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 30 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 30 #include "content/browser/frame_host/frame_tree.h" | 31 #include "content/browser/frame_host/frame_tree.h" |
| 31 #include "content/browser/gpu/compositor_util.h" | 32 #include "content/browser/gpu/compositor_util.h" |
| 32 #include "content/browser/gpu/gpu_data_manager_impl.h" | 33 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 33 #include "content/browser/gpu/gpu_process_host.h" | 34 #include "content/browser/gpu/gpu_process_host.h" |
| 34 #include "content/browser/gpu/gpu_surface_tracker.h" | 35 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 35 #include "content/browser/host_zoom_map_impl.h" | 36 #include "content/browser/host_zoom_map_impl.h" |
| 36 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 37 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 37 #include "content/browser/renderer_host/dip_util.h" | 38 #include "content/browser/renderer_host/dip_util.h" |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1005 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1005 // If the following DCHECK fails, you have encountered a tricky edge-case that | 1006 // If the following DCHECK fails, you have encountered a tricky edge-case that |
| 1006 // has evaded reproduction for a very long time. Please report what you were | 1007 // has evaded reproduction for a very long time. Please report what you were |
| 1007 // doing on http://crbug.com/407376, whether or not you can reproduce the | 1008 // doing on http://crbug.com/407376, whether or not you can reproduce the |
| 1008 // failure. | 1009 // failure. |
| 1009 DCHECK_EQ(page_id, page_id_); | 1010 DCHECK_EQ(page_id, page_id_); |
| 1010 | 1011 |
| 1011 // Without this check, the renderer can trick the browser into using | 1012 // Without this check, the renderer can trick the browser into using |
| 1012 // filenames it can't access in a future session restore. | 1013 // filenames it can't access in a future session restore. |
| 1013 if (!CanAccessFilesOfPageState(state)) { | 1014 if (!CanAccessFilesOfPageState(state)) { |
| 1014 GetProcess()->ReceivedBadMessage(); | 1015 bad_message::ReceivedBadMessage( |
| 1016 GetProcess(), bad_message::RVH_CAN_ACCESS_FILES_OF_PAGE_STATE); |
| 1015 return; | 1017 return; |
| 1016 } | 1018 } |
| 1017 | 1019 |
| 1018 delegate_->UpdateState(this, page_id, state); | 1020 delegate_->UpdateState(this, page_id, state); |
| 1019 } | 1021 } |
| 1020 | 1022 |
| 1021 void RenderViewHostImpl::OnUpdateTargetURL(const GURL& url) { | 1023 void RenderViewHostImpl::OnUpdateTargetURL(const GURL& url) { |
| 1022 if (is_active_) | 1024 if (is_active_) |
| 1023 delegate_->UpdateTargetURL(this, url); | 1025 delegate_->UpdateTargetURL(this, url); |
| 1024 | 1026 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 return; | 1372 return; |
| 1371 host_zoom_map->SetPageScaleFactorIsOneForView(GetProcess()->GetID(), | 1373 host_zoom_map->SetPageScaleFactorIsOneForView(GetProcess()->GetID(), |
| 1372 GetRoutingID(), is_one); | 1374 GetRoutingID(), is_one); |
| 1373 } | 1375 } |
| 1374 | 1376 |
| 1375 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { | 1377 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { |
| 1376 // Do not allow messages with absolute paths in them as this can permit a | 1378 // Do not allow messages with absolute paths in them as this can permit a |
| 1377 // renderer to coerce the browser to perform I/O on a renderer controlled | 1379 // renderer to coerce the browser to perform I/O on a renderer controlled |
| 1378 // path. | 1380 // path. |
| 1379 if (params.default_file_name != params.default_file_name.BaseName()) { | 1381 if (params.default_file_name != params.default_file_name.BaseName()) { |
| 1380 GetProcess()->ReceivedBadMessage(); | 1382 bad_message::ReceivedBadMessage(GetProcess(), |
| 1383 bad_message::RVH_FILE_CHOOSER_PATH); |
| 1381 return; | 1384 return; |
| 1382 } | 1385 } |
| 1383 | 1386 |
| 1384 delegate_->RunFileChooser(this, params); | 1387 delegate_->RunFileChooser(this, params); |
| 1385 } | 1388 } |
| 1386 | 1389 |
| 1387 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { | 1390 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { |
| 1388 #if defined(OS_WIN) | 1391 #if defined(OS_WIN) |
| 1389 if (editable) { | 1392 if (editable) { |
| 1390 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); | 1393 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1428 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1426 | 1429 |
| 1427 frame_tree->ResetForMainFrameSwap(); | 1430 frame_tree->ResetForMainFrameSwap(); |
| 1428 } | 1431 } |
| 1429 | 1432 |
| 1430 void RenderViewHostImpl::SelectWordAroundCaret() { | 1433 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1431 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1434 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1432 } | 1435 } |
| 1433 | 1436 |
| 1434 } // namespace content | 1437 } // namespace content |
| OLD | NEW |