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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_GIN_WRAPPER_H_
6 #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.
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/web_restrictions/interfaces/web_restrictions.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h"
12 #include "gin/wrappable.h"
13 #include "url/gurl.h"
14
15 namespace content {
16 class RenderFrame;
17 }
18
19 namespace supervised_user_error_page {
20
21 class SupervisedUserGinWrapper
22 : public gin::Wrappable<SupervisedUserGinWrapper>,
23 public content::RenderFrameObserver {
24 public:
25 static gin::WrapperInfo kWrapperInfo;
26
27 static void Install(content::RenderFrame* render_frame,
28 const std::string& url,
29 const web_restrictions::mojom::WebRestrictionsPtr&
30 web_restrictions_service);
31
32 private:
33 SupervisedUserGinWrapper(content::RenderFrame* render_frame,
34 const std::string& url,
35 const web_restrictions::mojom::WebRestrictionsPtr&
36 web_restrictions_service);
37 ~SupervisedUserGinWrapper() override;
38
39 // Override OnDestruct to prevent the wrapper going away when the
40 // RenderFrame does
41 void OnDestruct() override;
42
43 // Request permission to allow visiting the currently blocked site.
44 bool RequestPermission();
45
46 void OnAccessRequestAdded(bool success);
47
48 // gin::WrappableBase
49 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
50 v8::Isolate* isolate) override;
51
52 const std::string url_;
53 const web_restrictions::mojom::WebRestrictionsPtr& web_restrictions_service_;
54 base::WeakPtrFactory<SupervisedUserGinWrapper> weak_ptr_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(SupervisedUserGinWrapper);
57 };
58
59 } // namespace web_restrictions.
60
61 #endif // COMPONENTS_WEB_RESTRICTION_WEB_RESTRICTION_GIN_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698