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

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 18129002: Update the child process security policy to use explicit permission grants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 "chrome/browser/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 tab.pinned, 1037 tab.pinned,
1038 true, 1038 true,
1039 session_storage_namespace.get(), 1039 session_storage_namespace.get(),
1040 tab.user_agent_override); 1040 tab.user_agent_override);
1041 // Regression check: check that the tab didn't start loading right away. The 1041 // Regression check: check that the tab didn't start loading right away. The
1042 // focused tab will be loaded by Browser, and TabLoader will load the rest. 1042 // focused tab will be loaded by Browser, and TabLoader will load the rest.
1043 DCHECK(web_contents->GetController().NeedsReload()); 1043 DCHECK(web_contents->GetController().NeedsReload());
1044 1044
1045 // Set up the file access rights for the selected navigation entry. 1045 // Set up the file access rights for the selected navigation entry.
1046 const int id = web_contents->GetRenderProcessHost()->GetID(); 1046 const int id = web_contents->GetRenderProcessHost()->GetID();
1047 const int read_file_permissions =
1048 base::PLATFORM_FILE_OPEN |
1049 base::PLATFORM_FILE_READ |
1050 base::PLATFORM_FILE_EXCLUSIVE_READ |
1051 base::PLATFORM_FILE_ASYNC;
1052 const content::PageState& page_state = 1047 const content::PageState& page_state =
1053 tab.navigations.at(selected_index).page_state(); 1048 tab.navigations.at(selected_index).page_state();
1054 const std::vector<base::FilePath>& file_paths = 1049 const std::vector<base::FilePath>& file_paths =
1055 page_state.GetReferencedFiles(); 1050 page_state.GetReferencedFiles();
1056 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 1051 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
1057 file != file_paths.end(); ++file) { 1052 file != file_paths.end(); ++file) {
1058 content::ChildProcessSecurityPolicy::GetInstance()-> 1053 content::ChildProcessSecurityPolicy::GetInstance()->
1059 GrantPermissionsForFile(id, *file, read_file_permissions); 1054 GrantReadFile(id, *file);
vandebo (ex-Chrome) 2013/06/27 22:35:17 nit: I think this will wrap at "id,"
Greg Billock 2013/06/28 18:40:33 Done.
1060 } 1055 }
1061 1056
1062 if (schedule_load) 1057 if (schedule_load)
1063 tab_loader_->ScheduleLoad(&web_contents->GetController()); 1058 tab_loader_->ScheduleLoad(&web_contents->GetController());
1064 return web_contents; 1059 return web_contents;
1065 } 1060 }
1066 1061
1067 Browser* CreateRestoredBrowser(Browser::Type type, 1062 Browser* CreateRestoredBrowser(Browser::Type type,
1068 gfx::Rect bounds, 1063 gfx::Rect bounds,
1069 ui::WindowShowState show_state, 1064 ui::WindowShowState show_state,
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 if (!active_session_restorers) 1261 if (!active_session_restorers)
1267 return false; 1262 return false;
1268 for (std::set<SessionRestoreImpl*>::const_iterator it = 1263 for (std::set<SessionRestoreImpl*>::const_iterator it =
1269 active_session_restorers->begin(); 1264 active_session_restorers->begin();
1270 it != active_session_restorers->end(); ++it) { 1265 it != active_session_restorers->end(); ++it) {
1271 if ((*it)->synchronous()) 1266 if ((*it)->synchronous())
1272 return true; 1267 return true;
1273 } 1268 }
1274 return false; 1269 return false;
1275 } 1270 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698