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_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVER_H _ | |
6 #define COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVER_H _ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/weak_ptr.h" | |
10 #include "components/contextual_search/common/overlay_page_notifier_service.mojo m.h" | |
11 #include "content/public/renderer/render_frame.h" | |
12 #include "content/public/renderer/render_frame_observer.h" | |
13 #include "third_party/WebKit/public/web/WebLocalFrame.h" | |
14 #include "v8/include/v8.h" | |
15 | |
16 namespace contextual_search { | |
17 | |
18 // OverlayJsRenderFrame observer waits for a page to be loaded and then | |
19 // tries to connect to a mojo service hosted in the browser process. The | |
20 // service will tell this render process if the current page is presented | |
21 // in an overlay panel. | |
22 class OverlayJsRenderFrameObserver : public content::RenderFrameObserver { | |
23 public: | |
24 OverlayJsRenderFrameObserver(content::RenderFrame* render_frame); | |
jochen (gone - plz use gerrit)
2015/11/24 10:43:35
explicit
Donn Denman
2015/12/02 03:32:48
Done.
| |
25 ~OverlayJsRenderFrameObserver() override; | |
26 | |
27 // RenderFrameObserver implementation. | |
28 void DidStartProvisionalLoad() override; | |
29 void DidCreateNewDocument() override; | |
30 void DidFinishLoad() override; | |
31 | |
32 // Flag the current page as a contextual search overlay. | |
33 void SetIsContextualSearchOverlay(); | |
34 | |
35 private: | |
36 // Add the mojo service to a RenderFrame's service registry. | |
37 void RegisterMojoService(); | |
38 void CreateOverlayPageNotifierService( | |
39 mojo::InterfaceRequest<OverlayPageNotifierService> request); | |
40 | |
41 // Track if the current page is presented in the contextual search overlay. | |
42 bool is_contextual_search_overlay_; | |
43 | |
44 base::WeakPtrFactory<OverlayJsRenderFrameObserver> weak_factory_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(OverlayJsRenderFrameObserver); | |
47 }; | |
48 | |
49 } // namespace contextual_search | |
50 | |
51 #endif // COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVE R_H_ | |
OLD | NEW |