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

Unified Diff: components/supervised_user_error_page/supervised_user_gin_wrapper.h

Issue 1890203002: Implement Web Restrictions in WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: components/supervised_user_error_page/supervised_user_gin_wrapper.h
diff --git a/components/supervised_user_error_page/supervised_user_gin_wrapper.h b/components/supervised_user_error_page/supervised_user_gin_wrapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..66bee9e9e79e9d8de94d528bcca8217aa3423760
--- /dev/null
+++ b/components/supervised_user_error_page/supervised_user_gin_wrapper.h
@@ -0,0 +1,61 @@
+// 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_WEB_RESTRICTION_WEB_RESTRICTION_GIN_WRAPPER_H_
+#define COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_GIN_WRAPPER_H_
jochen (gone - plz use gerrit) 2016/04/17 17:07:05 please update the macro name
aberent 2016/05/18 20:06:50 Done.
+
+#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"
+
+namespace content {
+class RenderFrame;
+}
+
+namespace supervised_user_error_page {
+
+class SupervisedUserGinWrapper
+ : public gin::Wrappable<SupervisedUserGinWrapper>,
+ public content::RenderFrameObserver {
+ public:
+ static gin::WrapperInfo kWrapperInfo;
+
+ static void Install(content::RenderFrame* render_frame,
+ const std::string& url,
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service);
+
+ private:
+ SupervisedUserGinWrapper(content::RenderFrame* render_frame,
+ const std::string& url,
+ const web_restrictions::mojom::WebRestrictionsPtr&
+ web_restrictions_service);
+ ~SupervisedUserGinWrapper() override;
+
+ // Override OnDestruct to prevent the wrapper going away when the
+ // RenderFrame does
+ void OnDestruct() override;
+
+ // Request permission to allow visiting the currently blocked site.
+ bool RequestPermission();
+
+ 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_;
+ base::WeakPtrFactory<SupervisedUserGinWrapper> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(SupervisedUserGinWrapper);
+};
+
+} // namespace web_restrictions.
+
+#endif // COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_GIN_WRAPPER_H_

Powered by Google App Engine
This is Rietveld 408576698