• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Embedded Framework Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be found
3 // in the LICENSE file.
4 
5 #ifndef LIBCEF_RENDERER_RENDER_FRAME_OBSERVER_H_
6 #define LIBCEF_RENDERER_RENDER_FRAME_OBSERVER_H_
7 
8 #include "content/public/renderer/render_frame_observer.h"
9 
10 #include "services/service_manager/public/cpp/binder_registry.h"
11 #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
12 
13 namespace content {
14 class RenderFrame;
15 class RenderView;
16 }  // namespace content
17 
18 class CefFrameImpl;
19 
20 class CefRenderFrameObserver : public content::RenderFrameObserver {
21  public:
22   explicit CefRenderFrameObserver(content::RenderFrame* render_frame);
23 
24   CefRenderFrameObserver(const CefRenderFrameObserver&) = delete;
25   CefRenderFrameObserver& operator=(const CefRenderFrameObserver&) = delete;
26 
27   ~CefRenderFrameObserver() override;
28 
29   // RenderFrameObserver methods:
30   void WasShown() override;
31   void DidCommitProvisionalLoad(ui::PageTransition transition) override;
32   void DidFailProvisionalLoad() override;
33   void DidFinishLoad() override;
34   void WillDetach() override;
35   void FocusedElementChanged(const blink::WebElement& element) override;
36   void DraggableRegionsChanged() override;
37   void DidCreateScriptContext(v8::Handle<v8::Context> context,
38                               int world_id) override;
39   void WillReleaseScriptContext(v8::Handle<v8::Context> context,
40                                 int world_id) override;
41   void OnDestruct() override;
42   void OnInterfaceRequestForFrame(
43       const std::string& interface_name,
44       mojo::ScopedMessagePipeHandle* interface_pipe) override;
45   bool OnAssociatedInterfaceRequestForFrame(
46       const std::string& interface_name,
47       mojo::ScopedInterfaceEndpointHandle* handle) override;
48 
registry()49   service_manager::BinderRegistry* registry() { return &registry_; }
associated_interfaces()50   blink::AssociatedInterfaceRegistry* associated_interfaces() {
51     return &associated_interfaces_;
52   }
53 
54   void AttachFrame(CefFrameImpl* frame);
55 
56  private:
57   void OnLoadStart();
58   void OnLoadError();
59 
60   CefFrameImpl* frame_ = nullptr;
61 
62   service_manager::BinderRegistry registry_;
63 
64   // For interfaces which must be associated with some IPC::ChannelProxy,
65   // meaning that messages on the interface retain FIFO with respect to legacy
66   // Chrome IPC messages sent or dispatched on the channel.
67   blink::AssociatedInterfaceRegistry associated_interfaces_;
68 };
69 
70 #endif  // LIBCEF_RENDERER_RENDER_FRAME_OBSERVER_H_
71