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

Unified Diff: content/browser/shared/child_process_security_policy_helper.h

Issue 2111343002: Move implementation of ChildProcessSecurityPolicyImpl to c/b/shared, and wrap in c/b (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mffr-win
Patch Set: . Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/shared/child_process_security_policy_helper.h
diff --git a/content/browser/child_process_security_policy_impl.h b/content/browser/shared/child_process_security_policy_helper.h
similarity index 74%
copy from content/browser/child_process_security_policy_impl.h
copy to content/browser/shared/child_process_security_policy_helper.h
index 271e69c0acd110ed0e3d74f7b1d0c8512300973f..814bebe9a73dd4fd96fab36273e5785805f57087 100644
--- a/content/browser/child_process_security_policy_impl.h
+++ b/content/browser/shared/child_process_security_policy_helper.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
-#define CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
+#ifndef CONTENT_BROWSER_SHARED_CHILD_PROCESS_SECURITY_POLICY_HELPER_H_
+#define CONTENT_BROWSER_SHARED_CHILD_PROCESS_SECURITY_POLICY_HELPER_H_
#include <map>
#include <set>
@@ -15,9 +15,9 @@
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
-#include "content/public/browser/child_process_security_policy.h"
#include "content/public/common/resource_type.h"
#include "storage/common/fileapi/file_system_types.h"
+#include "url/origin.h"
class GURL;
@@ -31,52 +31,40 @@ class FileSystemURL;
namespace content {
-class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
- : NON_EXPORTED_BASE(public ChildProcessSecurityPolicy) {
+class CONTENT_EXPORT ChildProcessSecurityPolicyHelper {
public:
// Object can only be created through GetInstance() so the constructor is
// private.
- ~ChildProcessSecurityPolicyImpl() override;
-
- static ChildProcessSecurityPolicyImpl* GetInstance();
-
- // ChildProcessSecurityPolicy implementation.
- void RegisterWebSafeScheme(const std::string& scheme) override;
- bool IsWebSafeScheme(const std::string& scheme) override;
- void GrantReadFile(int child_id, const base::FilePath& file) override;
- void GrantCreateReadWriteFile(int child_id,
- const base::FilePath& file) override;
- void GrantCopyInto(int child_id, const base::FilePath& dir) override;
- void GrantDeleteFrom(int child_id, const base::FilePath& dir) override;
- void GrantReadFileSystem(int child_id,
- const std::string& filesystem_id) override;
- void GrantWriteFileSystem(int child_id,
- const std::string& filesystem_id) override;
+ ~ChildProcessSecurityPolicyHelper();
+
+ static ChildProcessSecurityPolicyHelper* GetInstance();
+
+ void RegisterWebSafeScheme(const std::string& scheme);
+ bool IsWebSafeScheme(const std::string& scheme);
+ void GrantReadFile(int child_id, const base::FilePath& file);
+ void GrantCreateReadWriteFile(int child_id, const base::FilePath& file);
+ void GrantCopyInto(int child_id, const base::FilePath& dir);
+ void GrantDeleteFrom(int child_id, const base::FilePath& dir);
+ void GrantReadFileSystem(int child_id, const std::string& filesystem_id);
+ void GrantWriteFileSystem(int child_id, const std::string& filesystem_id);
void GrantCreateFileForFileSystem(int child_id,
- const std::string& filesystem_id) override;
- void GrantCreateReadWriteFileSystem(
- int child_id,
- const std::string& filesystem_id) override;
- void GrantCopyIntoFileSystem(int child_id,
- const std::string& filesystem_id) override;
+ const std::string& filesystem_id);
+ void GrantCreateReadWriteFileSystem(int child_id,
+ const std::string& filesystem_id);
+ void GrantCopyIntoFileSystem(int child_id, const std::string& filesystem_id);
void GrantDeleteFromFileSystem(int child_id,
- const std::string& filesystem_id) override;
- void GrantOrigin(int child_id, const url::Origin& origin) override;
- void GrantScheme(int child_id, const std::string& scheme) override;
- bool CanReadFile(int child_id, const base::FilePath& file) override;
- bool CanCreateReadWriteFile(int child_id,
- const base::FilePath& file) override;
- bool CanReadFileSystem(int child_id,
- const std::string& filesystem_id) override;
- bool CanReadWriteFileSystem(int child_id,
- const std::string& filesystem_id) override;
- bool CanCopyIntoFileSystem(int child_id,
- const std::string& filesystem_id) override;
- bool CanDeleteFromFileSystem(int child_id,
- const std::string& filesystem_id) override;
- bool HasWebUIBindings(int child_id) override;
- void GrantSendMidiSysExMessage(int child_id) override;
- bool CanAccessDataForOrigin(int child_id, const GURL& url) override;
+ const std::string& filesystem_id);
+ void GrantOrigin(int child_id, const url::Origin& origin);
+ void GrantScheme(int child_id, const std::string& scheme);
+ bool CanReadFile(int child_id, const base::FilePath& file);
+ bool CanCreateReadWriteFile(int child_id, const base::FilePath& file);
+ bool CanReadFileSystem(int child_id, const std::string& filesystem_id);
+ bool CanReadWriteFileSystem(int child_id, const std::string& filesystem_id);
+ bool CanCopyIntoFileSystem(int child_id, const std::string& filesystem_id);
+ bool CanDeleteFromFileSystem(int child_id, const std::string& filesystem_id);
+ bool HasWebUIBindings(int child_id);
+ void GrantSendMidiSysExMessage(int child_id);
+ bool CanAccessDataForOrigin(int child_id, const GURL& url);
// Returns if |child_id| can read all of the |files|.
bool CanReadAllFiles(int child_id, const std::vector<base::FilePath>& files);
@@ -178,9 +166,9 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
typedef std::map<int, int> WorkerToMainProcessMap;
typedef std::map<storage::FileSystemType, int> FileSystemPermissionPolicyMap;
- // Obtain an instance of ChildProcessSecurityPolicyImpl via GetInstance().
- ChildProcessSecurityPolicyImpl();
- friend struct base::DefaultSingletonTraits<ChildProcessSecurityPolicyImpl>;
+ // Obtain an instance of ChildProcessSecurityPolicyHelper via GetInstance().
+ ChildProcessSecurityPolicyHelper();
+ friend struct base::DefaultSingletonTraits<ChildProcessSecurityPolicyHelper>;
// Adds child process during registration.
void AddChild(int child_id);
@@ -200,10 +188,9 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
// Grants access permission to the given isolated file system
// identified by |filesystem_id|. See comments for
// ChildProcessSecurityPolicy::GrantReadFileSystem() for more details.
- void GrantPermissionsForFileSystem(
- int child_id,
- const std::string& filesystem_id,
- int permission);
+ void GrantPermissionsForFileSystem(int child_id,
+ const std::string& filesystem_id,
+ int permission);
// Determines if certain permissions were granted for a file. |permissions|
// is an internally defined bit-set. If |child_id| is a worker process,
@@ -221,10 +208,9 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
// Determines if certain permissions were granted for a file system.
// |permissions| is an internally defined bit-set.
- bool HasPermissionsForFileSystem(
- int child_id,
- const std::string& filesystem_id,
- int permission);
+ bool HasPermissionsForFileSystem(int child_id,
+ const std::string& filesystem_id,
+ int permission);
// You must acquire this lock before reading or writing any members of this
// class. You must not block while holding this lock.
@@ -251,9 +237,9 @@ class CONTENT_EXPORT ChildProcessSecurityPolicyImpl
FileSystemPermissionPolicyMap file_system_policy_map_;
- DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyImpl);
+ DISALLOW_COPY_AND_ASSIGN(ChildProcessSecurityPolicyHelper);
};
} // namespace content
-#endif // CONTENT_BROWSER_CHILD_PROCESS_SECURITY_POLICY_IMPL_H_
+#endif // CONTENT_BROWSER_SHARED_CHILD_PROCESS_SECURITY_POLICY_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698