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

Unified Diff: third_party/WebKit/Source/web/StorageClientImpl.cpp

Issue 2786673002: Separate ContentSettingsClient out from LocalFrameClient (Closed)
Patch Set: added class-level comment Created 3 years, 8 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: third_party/WebKit/Source/web/StorageClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/StorageClientImpl.cpp b/third_party/WebKit/Source/web/StorageClientImpl.cpp
index f0527cc0da9e92e0fdc8366134b5dccb0c2d3ff2..05133b42963d7e21b4c71e91306f4e94244866f2 100644
--- a/third_party/WebKit/Source/web/StorageClientImpl.cpp
+++ b/third_party/WebKit/Source/web/StorageClientImpl.cpp
@@ -25,17 +25,24 @@
#include "web/StorageClientImpl.h"
+#include <memory>
+#include "core/frame/ContentSettingsClient.h"
#include "modules/storage/StorageNamespace.h"
#include "public/platform/WebStorageNamespace.h"
-#include "public/web/WebContentSettingsClient.h"
#include "public/web/WebViewClient.h"
-#include "web/WebLocalFrameImpl.h"
#include "web/WebViewImpl.h"
#include "wtf/PtrUtil.h"
-#include <memory>
namespace blink {
+#define STATIC_ASSERT_MATCHING_ENUM(enum_name1, enum_name2) \
+ static_assert(static_cast<int>(enum_name1) == static_cast<int>(enum_name2), \
+ "mismatching enums: " #enum_name1)
+STATIC_ASSERT_MATCHING_ENUM(LocalStorage,
+ ContentSettingsClient::StorageType::kLocal);
+STATIC_ASSERT_MATCHING_ENUM(SessionStorage,
+ ContentSettingsClient::StorageType::kSession);
+
StorageClientImpl::StorageClientImpl(WebViewImpl* webView)
: m_webView(webView) {}
@@ -49,9 +56,9 @@ StorageClientImpl::createSessionStorageNamespace() {
bool StorageClientImpl::canAccessStorage(LocalFrame* frame,
StorageType type) const {
- WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame);
- return !webFrame->contentSettingsClient() ||
- webFrame->contentSettingsClient()->allowStorage(type == LocalStorage);
+ DCHECK(frame->contentSettingsClient());
+ return frame->contentSettingsClient()->allowStorage(
+ static_cast<ContentSettingsClient::StorageType>(type));
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.cpp ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698