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

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

Powered by Google App Engine
This is Rietveld 408576698