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

Unified Diff: components/supervised_user_error_page/gin_wrapper.h

Issue 1890203002: Implement Web Restrictions in WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix final nits Created 4 years, 4 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
« no previous file with comments | « components/supervised_user_error_page/DEPS ('k') | components/supervised_user_error_page/gin_wrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/supervised_user_error_page/gin_wrapper.h
diff --git a/components/supervised_user_error_page/gin_wrapper.h b/components/supervised_user_error_page/gin_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..b59104190b7c733b2a79628f03fa9d3a248eeb8e
--- /dev/null
+++ b/components/supervised_user_error_page/gin_wrapper.h
@@ -0,0 +1,78 @@
+// Copyright 2015 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 COMPONENTS_SUPERVISED_USER_ERROR_PAGE_GIN_WRAPPER_H_
+#define COMPONENTS_SUPERVISED_USER_ERROR_PAGE_GIN_WRAPPER_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "components/web_restrictions/interfaces/web_restrictions.mojom.h"
+#include "content/public/renderer/render_frame_observer.h"
+#include "gin/wrappable.h"
+#include "url/gurl.h"
+#include "v8/include/v8.h"
+
+namespace content {
+class RenderFrame;
+}
+
+namespace supervised_user_error_page {
+
+class GinWrapper : public gin::Wrappable<GinWrapper> {
+ public:
+ static gin::WrapperInfo kWrapperInfo;
+
+ static void InstallWhenFrameReady(
+ content::RenderFrame* render_frame,
+ const std::string& url,
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service);
+
+ private:
+ class Loader : public content::RenderFrameObserver {
+ public:
+ Loader(content::RenderFrame* render_frame,
+ const std::string& url,
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service);
+ ~Loader() override = default;
+
+ void DidClearWindowObject() override;
+ void OnDestruct() override;
+
+ private:
+ void InstallGinWrapper();
+
+ std::string url_;
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service_;
+ DISALLOW_COPY_AND_ASSIGN(Loader);
+ };
+
+ GinWrapper(content::RenderFrame* render_frame,
+ const std::string& url,
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service);
+ ~GinWrapper() override;
+
+ // Request permission to allow visiting the currently blocked site.
+ bool RequestPermission(v8::Local<v8::Function> setRequestStatusCallback);
+
+ void OnAccessRequestAdded(bool success);
+
+ // gin::WrappableBase
+ gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
+ v8::Isolate* isolate) override;
+
+ const std::string url_;
+ const web_restrictions::mojom::WebRestrictionsPtr& web_restrictions_service_;
+ v8::Global<v8::Function> setRequestStatusCallback_;
+ base::WeakPtrFactory<GinWrapper> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(GinWrapper);
+};
+
+} // namespace supervised_user_error_page.
+
+#endif // COMPONENTS_SUPERVISED_USER_ERROR_PAGE_GIN_WRAPPER_H_
« no previous file with comments | « components/supervised_user_error_page/DEPS ('k') | components/supervised_user_error_page/gin_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698