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

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: Rebase (again!) 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: 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..328a08e099799f0fde1a7fa9708b78284fdbbb6b
--- /dev/null
+++ b/components/supervised_user_error_page/gin_wrapper.h
@@ -0,0 +1,73 @@
+// 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 {
jochen (gone - plz use gerrit) 2016/06/07 19:16:18 please add a virtual dtor
aberent 2016/07/12 18:48:24 Done.
+ public:
+ Loader(content::RenderFrame* render_frame,
+ const std::string& url,
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service);
+
+ void DidClearWindowObject() override;
+
+ private:
+ std::string url_;
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service_;
+ };
jochen (gone - plz use gerrit) 2016/06/07 19:16:18 disallow copy & assign
aberent 2016/07/12 18:48:24 Done.
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698