Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(584)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 14985014: Introduce content::PageState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation issues. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "content/public/common/result_codes.h" 60 #include "content/public/common/result_codes.h"
61 #include "content/public/common/url_constants.h" 61 #include "content/public/common/url_constants.h"
62 #include "net/base/net_util.h" 62 #include "net/base/net_util.h"
63 #include "net/url_request/url_request_context_getter.h" 63 #include "net/url_request/url_request_context_getter.h"
64 #include "third_party/skia/include/core/SkBitmap.h" 64 #include "third_party/skia/include/core/SkBitmap.h"
65 #include "ui/gfx/image/image_skia.h" 65 #include "ui/gfx/image/image_skia.h"
66 #include "ui/gfx/native_widget_types.h" 66 #include "ui/gfx/native_widget_types.h"
67 #include "ui/shell_dialogs/selected_file_info.h" 67 #include "ui/shell_dialogs/selected_file_info.h"
68 #include "ui/snapshot/snapshot.h" 68 #include "ui/snapshot/snapshot.h"
69 #include "webkit/fileapi/isolated_context.h" 69 #include "webkit/fileapi/isolated_context.h"
70 #include "webkit/glue/glue_serialize.h"
71 #include "webkit/glue/webdropdata.h" 70 #include "webkit/glue/webdropdata.h"
72 #include "webkit/glue/webkit_glue.h" 71 #include "webkit/glue/webkit_glue.h"
73 72
74 #if defined(OS_WIN) 73 #if defined(OS_WIN)
75 #include "base/win/windows_version.h" 74 #include "base/win/windows_version.h"
76 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h" 75 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact ory.h"
77 #elif defined(OS_MACOSX) 76 #elif defined(OS_MACOSX)
78 #include "content/browser/renderer_host/popup_menu_helper_mac.h" 77 #include "content/browser/renderer_host/popup_menu_helper_mac.h"
79 #elif defined(OS_ANDROID) 78 #elif defined(OS_ANDROID)
80 #include "content/browser/android/media_player_manager_impl.h" 79 #include "content/browser/android/media_player_manager_impl.h"
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 for (std::vector<GURL>::iterator it(validated_params.redirects.begin()); 1226 for (std::vector<GURL>::iterator it(validated_params.redirects.begin());
1228 it != validated_params.redirects.end(); ++it) { 1227 it != validated_params.redirects.end(); ++it) {
1229 FilterURL(policy, process, false, &(*it)); 1228 FilterURL(policy, process, false, &(*it));
1230 } 1229 }
1231 FilterURL(policy, process, true, &validated_params.searchable_form_url); 1230 FilterURL(policy, process, true, &validated_params.searchable_form_url);
1232 FilterURL(policy, process, true, &validated_params.password_form.origin); 1231 FilterURL(policy, process, true, &validated_params.password_form.origin);
1233 FilterURL(policy, process, true, &validated_params.password_form.action); 1232 FilterURL(policy, process, true, &validated_params.password_form.action);
1234 1233
1235 // Without this check, the renderer can trick the browser into using 1234 // Without this check, the renderer can trick the browser into using
1236 // filenames it can't access in a future session restore. 1235 // filenames it can't access in a future session restore.
1237 if (!CanAccessFilesOfSerializedState(validated_params.content_state)) { 1236 if (!CanAccessFilesOfPageState(validated_params.page_state)) {
1238 GetProcess()->ReceivedBadMessage(); 1237 GetProcess()->ReceivedBadMessage();
1239 return; 1238 return;
1240 } 1239 }
1241 1240
1242 delegate_->DidNavigate(this, validated_params); 1241 delegate_->DidNavigate(this, validated_params);
1243 } 1242 }
1244 1243
1245 void RenderViewHostImpl::OnUpdateState(int32 page_id, 1244 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) {
1246 const std::string& state) {
1247 // Without this check, the renderer can trick the browser into using 1245 // Without this check, the renderer can trick the browser into using
1248 // filenames it can't access in a future session restore. 1246 // filenames it can't access in a future session restore.
1249 if (!CanAccessFilesOfSerializedState(state)) { 1247 if (!CanAccessFilesOfPageState(state)) {
1250 GetProcess()->ReceivedBadMessage(); 1248 GetProcess()->ReceivedBadMessage();
1251 return; 1249 return;
1252 } 1250 }
1253 1251
1254 delegate_->UpdateState(this, page_id, state); 1252 delegate_->UpdateState(this, page_id, state);
1255 } 1253 }
1256 1254
1257 void RenderViewHostImpl::OnUpdateTitle( 1255 void RenderViewHostImpl::OnUpdateTitle(
1258 int32 page_id, 1256 int32 page_id,
1259 const string16& title, 1257 const string16& title,
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 // can cause navigations to be ignored in OnNavigate. 2064 // can cause navigations to be ignored in OnNavigate.
2067 is_waiting_for_beforeunload_ack_ = false; 2065 is_waiting_for_beforeunload_ack_ = false;
2068 is_waiting_for_unload_ack_ = false; 2066 is_waiting_for_unload_ack_ = false;
2069 has_timed_out_on_unload_ = false; 2067 has_timed_out_on_unload_ = false;
2070 } 2068 }
2071 2069
2072 void RenderViewHostImpl::ClearPowerSaveBlockers() { 2070 void RenderViewHostImpl::ClearPowerSaveBlockers() {
2073 STLDeleteValues(&power_save_blockers_); 2071 STLDeleteValues(&power_save_blockers_);
2074 } 2072 }
2075 2073
2076 bool RenderViewHostImpl::CanAccessFilesOfSerializedState( 2074 bool RenderViewHostImpl::CanAccessFilesOfPageState(
2077 const std::string& state) const { 2075 const PageState& state) const {
2078 ChildProcessSecurityPolicyImpl* policy = 2076 ChildProcessSecurityPolicyImpl* policy =
2079 ChildProcessSecurityPolicyImpl::GetInstance(); 2077 ChildProcessSecurityPolicyImpl::GetInstance();
2080 const std::vector<base::FilePath>& file_paths = 2078
2081 webkit_glue::FilePathsFromHistoryState(state); 2079 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
2082 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 2080 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
2083 file != file_paths.end(); ++file) { 2081 file != file_paths.end(); ++file) {
2084 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) 2082 if (!policy->CanReadFile(GetProcess()->GetID(), *file))
2085 return false; 2083 return false;
2086 } 2084 }
2087 return true; 2085 return true;
2088 } 2086 }
2089 2087
2090 } // namespace content 2088 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698