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 "third_party/WebKit/public/web/WebLocalFrame.h" | 13 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
15 | 15 |
16 namespace contextual_search { | 16 namespace contextual_search { |
17 | 17 |
18 // OverlayJsRenderFrame observer waits for a page to be loaded and then | 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 | 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 | 20 // service will tell this render process if the current page is presented |
21 // in an overlay panel. | 21 // in an overlay panel. |
22 class OverlayJsRenderFrameObserver : public content::RenderFrameObserver { | 22 class OverlayJsRenderFrameObserver : public content::RenderFrameObserver { |
23 public: | 23 public: |
24 explicit OverlayJsRenderFrameObserver(content::RenderFrame* render_frame); | 24 explicit OverlayJsRenderFrameObserver(content::RenderFrame* render_frame); |
25 ~OverlayJsRenderFrameObserver() override; | 25 ~OverlayJsRenderFrameObserver() override; |
26 | 26 |
27 // RenderFrameObserver implementation. | 27 // RenderFrameObserver implementation. |
28 void DidStartProvisionalLoad() override; | 28 void DidStartProvisionalLoad(blink::WebDataSource* data_source) override; |
29 void DidClearWindowObject() override; | 29 void DidClearWindowObject() override; |
30 void DidFinishLoad() override; | 30 void DidFinishLoad() override; |
31 | 31 |
32 // Flag the current page as a contextual search overlay. | 32 // Flag the current page as a contextual search overlay. |
33 void SetIsContextualSearchOverlay(); | 33 void SetIsContextualSearchOverlay(); |
34 | 34 |
35 private: | 35 private: |
36 // RenderFrameObserver implementation. | 36 // RenderFrameObserver implementation. |
37 void OnDestruct() override; | 37 void OnDestruct() override; |
38 | 38 |
(...skipping 11 matching lines...) Expand all Loading... |
50 bool is_contextual_search_overlay_; | 50 bool is_contextual_search_overlay_; |
51 | 51 |
52 base::WeakPtrFactory<OverlayJsRenderFrameObserver> weak_factory_; | 52 base::WeakPtrFactory<OverlayJsRenderFrameObserver> weak_factory_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(OverlayJsRenderFrameObserver); | 54 DISALLOW_COPY_AND_ASSIGN(OverlayJsRenderFrameObserver); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace contextual_search | 57 } // namespace contextual_search |
58 | 58 |
59 #endif // COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVE
R_H_ | 59 #endif // COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_OVERLAY_JS_RENDER_FRAME_OBSERVE
R_H_ |
OLD | NEW |