OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVER_H
_ | 5 #ifndef COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVER_H
_ |
6 #define COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVER_H
_ | 6 #define COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVER_H
_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "components/contextual_search/common/overlay_page_notifier_service.mojo
m.h" | 10 #include "components/contextual_search/common/overlay_page_notifier_service.mojo
m.h" |
11 #include "content/public/renderer/render_frame.h" | 11 #include "content/public/renderer/render_frame.h" |
12 #include "content/public/renderer/render_frame_observer.h" | 12 #include "content/public/renderer/render_frame_observer.h" |
| 13 #include "services/service_manager/public/cpp/bind_source_info.h" |
13 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 14 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
14 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
15 | 16 |
16 namespace contextual_search { | 17 namespace contextual_search { |
17 | 18 |
18 // OverlayJsRenderFrame observer waits for a page to be loaded and then | 19 // 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 // 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 // service will tell this render process if the current page is presented |
21 // in an overlay panel. | 22 // in an overlay panel. |
22 class OverlayJsRenderFrameObserver : public content::RenderFrameObserver { | 23 class OverlayJsRenderFrameObserver : public content::RenderFrameObserver { |
(...skipping 12 matching lines...) Expand all Loading... |
35 private: | 36 private: |
36 // RenderFrameObserver implementation. | 37 // RenderFrameObserver implementation. |
37 void OnDestruct() override; | 38 void OnDestruct() override; |
38 | 39 |
39 // Add the mojo interface to a RenderFrame's | 40 // Add the mojo interface to a RenderFrame's |
40 // service_manager::InterfaceRegistry. | 41 // service_manager::InterfaceRegistry. |
41 void RegisterMojoInterface(); | 42 void RegisterMojoInterface(); |
42 // Creates the OverlayPageNotifierService connecting the browser to this | 43 // Creates the OverlayPageNotifierService connecting the browser to this |
43 // observer. | 44 // observer. |
44 void CreateOverlayPageNotifierService( | 45 void CreateOverlayPageNotifierService( |
45 mojo::InterfaceRequest<mojom::OverlayPageNotifierService> request); | 46 const service_manager::BindSourceInfo& source_info, |
| 47 mojom::OverlayPageNotifierServiceRequest request); |
46 // Destroys the OverlayPageNotifierService. | 48 // Destroys the OverlayPageNotifierService. |
47 void DestroyOverlayPageNotifierService(); | 49 void DestroyOverlayPageNotifierService(); |
48 | 50 |
49 // Track if the current page is presented in the contextual search overlay. | 51 // Track if the current page is presented in the contextual search overlay. |
50 bool is_contextual_search_overlay_; | 52 bool is_contextual_search_overlay_; |
51 | 53 |
52 base::WeakPtrFactory<OverlayJsRenderFrameObserver> weak_factory_; | 54 base::WeakPtrFactory<OverlayJsRenderFrameObserver> weak_factory_; |
53 | 55 |
54 DISALLOW_COPY_AND_ASSIGN(OverlayJsRenderFrameObserver); | 56 DISALLOW_COPY_AND_ASSIGN(OverlayJsRenderFrameObserver); |
55 }; | 57 }; |
56 | 58 |
57 } // namespace contextual_search | 59 } // namespace contextual_search |
58 | 60 |
59 #endif // COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVE
R_H_ | 61 #endif // COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVE
R_H_ |
OLD | NEW |