Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_SUPERVISED_USER_ERROR_PAGE_GIN_WRAPPER_H_ | |
| 6 #define COMPONENTS_SUPERVISED_USER_ERROR_PAGE_GIN_WRAPPER_H_ | |
| 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 #include "v8/include/v8.h" | |
| 15 | |
| 16 namespace content { | |
| 17 class RenderFrame; | |
| 18 } | |
| 19 | |
| 20 namespace supervised_user_error_page { | |
| 21 | |
| 22 class GinWrapper : public gin::Wrappable<GinWrapper> { | |
| 23 public: | |
| 24 static gin::WrapperInfo kWrapperInfo; | |
| 25 | |
| 26 static void InstallWhenFrameReady( | |
| 27 content::RenderFrame* render_frame, | |
| 28 const std::string& url, | |
| 29 const web_restrictions::mojom::WebRestrictionsPtr& | |
| 30 web_restrictions_service); | |
| 31 | |
| 32 private: | |
| 33 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.
| |
| 34 public: | |
| 35 Loader(content::RenderFrame* render_frame, | |
| 36 const std::string& url, | |
| 37 const web_restrictions::mojom::WebRestrictionsPtr& | |
| 38 web_restrictions_service); | |
| 39 | |
| 40 void DidClearWindowObject() override; | |
| 41 | |
| 42 private: | |
| 43 std::string url_; | |
| 44 const web_restrictions::mojom::WebRestrictionsPtr& | |
| 45 web_restrictions_service_; | |
| 46 }; | |
|
jochen (gone - plz use gerrit)
2016/06/07 19:16:18
disallow copy & assign
aberent
2016/07/12 18:48:24
Done.
| |
| 47 | |
| 48 GinWrapper(content::RenderFrame* render_frame, | |
| 49 const std::string& url, | |
| 50 const web_restrictions::mojom::WebRestrictionsPtr& | |
| 51 web_restrictions_service); | |
| 52 ~GinWrapper() override; | |
| 53 | |
| 54 // Request permission to allow visiting the currently blocked site. | |
| 55 bool RequestPermission(v8::Local<v8::Function> setRequestStatusCallback); | |
| 56 | |
| 57 void OnAccessRequestAdded(bool success); | |
| 58 | |
| 59 // gin::WrappableBase | |
| 60 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | |
| 61 v8::Isolate* isolate) override; | |
| 62 | |
| 63 const std::string url_; | |
| 64 const web_restrictions::mojom::WebRestrictionsPtr& web_restrictions_service_; | |
| 65 v8::Global<v8::Function> setRequestStatusCallback_; | |
| 66 base::WeakPtrFactory<GinWrapper> weak_ptr_factory_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(GinWrapper); | |
| 69 }; | |
| 70 | |
| 71 } // namespace supervised_user_error_page. | |
| 72 | |
| 73 #endif // COMPONENTS_SUPERVISED_USER_ERROR_PAGE_GIN_WRAPPER_H_ | |
| OLD | NEW |