Skip to content

Commit

Permalink
Respond to review comments (nov18 16:56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrobinson committed Nov 19, 2020
1 parent 0ca55c8 commit b88c2a9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
12 changes: 5 additions & 7 deletions chromium_src/net/cookies/cookie_monster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace {

CookieOptions OptionsWithoutEphemeralStorageURL(const CookieOptions& options) {
CookieOptions new_options(options);
new_options.top_frame_url_for_ephemeral_storage_ = GURL();
new_options.top_frame_url_ = GURL();
return new_options;
}

Expand Down Expand Up @@ -59,10 +59,9 @@ void CookieMonster::SetCanonicalCookieAsync(
const GURL& source_url,
const CookieOptions& options,
SetCookiesCallback callback) {
if (!options.top_frame_url_for_ephemeral_storage_.is_empty()) {
if (!options.top_frame_url_.is_empty()) {
SimpleCookieMonster* ephemeral_monster =
GetOrCreateEphemeralCookieStoreForTopFrameURL(
options.top_frame_url_for_ephemeral_storage_);
GetOrCreateEphemeralCookieStoreForTopFrameURL(options.top_frame_url_);
ephemeral_monster->SetCanonicalCookieAsync(
std::move(cookie), source_url,
OptionsWithoutEphemeralStorageURL(options), std::move(callback));
Expand All @@ -76,10 +75,9 @@ void CookieMonster::GetCookieListWithOptionsAsync(
const GURL& url,
const CookieOptions& options,
GetCookieListCallback callback) {
if (!options.top_frame_url_for_ephemeral_storage_.is_empty()) {
if (!options.top_frame_url_.is_empty()) {
SimpleCookieMonster* ephemeral_monster =
GetOrCreateEphemeralCookieStoreForTopFrameURL(
options.top_frame_url_for_ephemeral_storage_);
GetOrCreateEphemeralCookieStoreForTopFrameURL(options.top_frame_url_);
ephemeral_monster->GetCookieListWithOptionsAsync(
url, OptionsWithoutEphemeralStorageURL(options), std::move(callback));
return;
Expand Down
2 changes: 1 addition & 1 deletion chromium_src/net/cookies/cookie_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define BRAVE_COOKIE_OPTIONS_H \
public: \
GURL top_frame_url_for_ephemeral_storage_;
GURL top_frame_url_;

#include "../../../../../net/cookies/cookie_options.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
* 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/. */

#define BRAVE_STRUCTTRAITSCOOKIEOPTIONS_READ \
GURL top_frame_url_for_ephemeral_storage; \
if (!mojo_options.ReadTopFrameUrlForEphemeralStorage( \
&top_frame_url_for_ephemeral_storage)) \
return false; \
cookie_options->top_frame_url_for_ephemeral_storage_ = \
top_frame_url_for_ephemeral_storage;
#define BRAVE_STRUCTTRAITSCOOKIEOPTIONS_READ \
GURL top_frame_url; \
if (!mojo_options.ReadTopFrameUrl(&top_frame_url)) \
return false; \
cookie_options->top_frame_url_ = top_frame_url;

#include "../../../../../services/network/public/cpp/cookie_manager_mojom_traits.cc"
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
#define BRAVE_CHROMIUM_SRC_SERVICES_NETWORK_PUBLIC_CPP_COOKIE_MANAGER_MOJOM_TRAITS_H_

#define BRAVE_STRUCTTRAITSCOOKIEOPTIONSEPHEMERALSTORAGEDOMAIN \
static GURL top_frame_url_for_ephemeral_storage( \
const net::CookieOptions& o) { \
return o.top_frame_url_for_ephemeral_storage_; \
static GURL top_frame_url(const net::CookieOptions& o) { \
return o.top_frame_url_; \
}

#include "../../../../../services/network/public/cpp/cookie_manager_mojom_traits.h"
Expand Down
2 changes: 1 addition & 1 deletion chromium_src/services/network/restricted_cookie_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void AddEphemeralStorageDomainIfNecessary(const GURL& url,
return;
if (url::Origin::Create(url) == top_frame_origin)
return;
options->top_frame_url_for_ephemeral_storage_ = top_frame_origin.GetURL();
options->top_frame_url_ = top_frame_origin.GetURL();
}

} // namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/services/network/public/mojom/cookie_manager.mojom b/services/network/public/mojom/cookie_manager.mojom
index efb5fa353efa87c39de48c477c0bddd8dc4d4b19..3ab93ead231af68d1cf93002110c2ec04bc977bb 100644
index efb5fa353efa87c39de48c477c0bddd8dc4d4b19..b9353e785a9e980acb0a5768567c4c81a324864b 100644
--- a/services/network/public/mojom/cookie_manager.mojom
+++ b/services/network/public/mojom/cookie_manager.mojom
@@ -114,6 +114,7 @@ struct CookieOptions {
CookieSameSiteContext same_site_cookie_context;
bool update_access_time = true;
bool return_excluded_cookies = false;
+ url.mojom.Url top_frame_url_for_ephemeral_storage;
+ url.mojom.Url top_frame_url;
};

// See net/cookies/canonical_cookie.{h,cc} for documentation.
Expand Down

0 comments on commit b88c2a9

Please sign in to comment.