-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify ephemeral storage trigger logic to use net::CookieOptions.
- Loading branch information
Showing
29 changed files
with
714 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include_rules = [ | ||
"+../../../../../components/content_settings/browser", | ||
"+components/content_settings/browser", | ||
"+components/content_settings/common", | ||
] |
23 changes: 23 additions & 0 deletions
23
chromium_src/components/content_settings/browser/content_settings_manager_impl.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "components/content_settings/browser/content_settings_manager_impl.h" | ||
|
||
#include "../../../../../components/content_settings/browser/content_settings_manager_impl.cc" | ||
|
||
namespace content_settings { | ||
|
||
void ContentSettingsManagerImpl::AllowEphemeralStorageAccess( | ||
int32_t render_frame_id, | ||
StorageType storage_type, | ||
const url::Origin& origin, | ||
const GURL& site_for_cookies, | ||
const url::Origin& top_frame_origin, | ||
base::OnceCallback<void(bool)> callback) { | ||
std::move(callback).Run(cookie_settings_->ShouldUseEphemeralStorage( | ||
origin.GetURL(), site_for_cookies, top_frame_origin)); | ||
} | ||
|
||
} // namespace content_settings |
24 changes: 24 additions & 0 deletions
24
chromium_src/components/content_settings/browser/content_settings_manager_impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* Copyright 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_CHROMIUM_SRC_COMPONENTS_CONTENT_SETTINGS_BROWSER_CONTENT_SETTINGS_MANAGER_IMPL_H_ | ||
#define BRAVE_CHROMIUM_SRC_COMPONENTS_CONTENT_SETTINGS_BROWSER_CONTENT_SETTINGS_MANAGER_IMPL_H_ | ||
|
||
#include "components/content_settings/common/content_settings_manager.mojom.h" | ||
|
||
#define OnContentBlocked \ | ||
NotUsed() {} \ | ||
void AllowEphemeralStorageAccess( \ | ||
int32_t render_frame_id, StorageType storage_type, \ | ||
const url::Origin& origin, const GURL& site_for_cookies, \ | ||
const url::Origin& top_frame_origin, \ | ||
base::OnceCallback<void(bool)> callback) override; \ | ||
void OnContentBlocked | ||
|
||
#include "../../../../../components/content_settings/browser/content_settings_manager_impl.h" | ||
|
||
#undef OnContentBlocked | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_COMPONENTS_CONTENT_SETTINGS_BROWSER_CONTENT_SETTINGS_MANAGER_IMPL_H_ |
15 changes: 15 additions & 0 deletions
15
chromium_src/components/content_settings/common/content_settings_manager.mojom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module content_settings.mojom; | ||
|
||
import "url/mojom/origin.mojom"; | ||
import "url/mojom/url.mojom"; | ||
|
||
[BraveExtend] | ||
interface ContentSettingsManager { | ||
[Sync] | ||
AllowEphemeralStorageAccess( | ||
int32 render_frame_id, | ||
StorageType storage_type, | ||
url.mojom.Origin origin, | ||
url.mojom.Url site_for_cookies, | ||
url.mojom.Origin top_frame_origin) => (bool ephemeral_storage_allowed); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "net/cookies/cookie_access_delegate.h" | ||
|
||
#include "base/notreached.h" | ||
|
||
#include "../../../../net/cookies/cookie_access_delegate.cc" | ||
|
||
namespace net { | ||
|
||
bool CookieAccessDelegate::NotUsed() const { | ||
return false; | ||
} | ||
|
||
bool CookieAccessDelegate::ShouldUseEphemeralStorage( | ||
const GURL& url, | ||
const net::SiteForCookies& site_for_cookies, | ||
const base::Optional<url::Origin>& top_frame_origin) const { | ||
NOTREACHED() << "Should be overridden"; | ||
return false; | ||
} | ||
|
||
} // namespace net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_CHROMIUM_SRC_NET_COOKIES_COOKIE_ACCESS_DELEGATE_H_ | ||
#define BRAVE_CHROMIUM_SRC_NET_COOKIES_COOKIE_ACCESS_DELEGATE_H_ | ||
|
||
#include "base/optional.h" | ||
#include "net/cookies/site_for_cookies.h" | ||
#include "url/gurl.h" | ||
#include "url/origin.h" | ||
|
||
#define ShouldTreatUrlAsTrustworthy \ | ||
NotUsed() const; \ | ||
virtual bool ShouldUseEphemeralStorage( \ | ||
const GURL& url, const net::SiteForCookies& site_for_cookies, \ | ||
const base::Optional<url::Origin>& top_frame_origin) const; \ | ||
virtual bool ShouldTreatUrlAsTrustworthy | ||
|
||
#include "../../../../net/cookies/cookie_access_delegate.h" | ||
|
||
#undef ShouldTreatUrlAsTrustworthy | ||
|
||
#endif // BRAVE_CHROMIUM_SRC_NET_COOKIES_COOKIE_ACCESS_DELEGATE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.