Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: components/contextual_search/overlay_js_render_frame_observer.h

Issue 1385663002: [Contextual Search] Add Mojo-enabled API component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked to use a new Contextual Search component and Mojo communication, removed CS Manager stuff. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_OVERLAY_JS_RENDER_FRAME_OBSERVER_H_
6 #define COMPONENTS_CONTEXTUAL_SEARCH_OVERLAY_JS_RENDER_FRAME_OBSERVER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "components/contextual_search/overlay_page_notifier_service.mojom.h"
10 #include "content/public/renderer/render_frame.h"
11 #include "content/public/renderer/render_frame_observer.h"
12 #include "third_party/WebKit/public/web/WebLocalFrame.h"
13 #include "v8/include/v8.h"
14
15 namespace contextual_search {
16
17 // OverlayJsRenderFrame observer waits for a page to be loaded and then
18 // tries to connect to a mojo service hosted in the browser process. The
19 // service will tell this render process if the current page is presented
20 // in an overlay panel.
21 class OverlayJsRenderFrameObserver : public content::RenderFrameObserver {
22 public:
23 OverlayJsRenderFrameObserver(content::RenderFrame* render_frame);
24 ~OverlayJsRenderFrameObserver() override;
25
26 // RenderFrameObserver implementation.
27 void DidStartProvisionalLoad() override;
28 void DidCreateNewDocument() override;
29 void DidFinishLoad() override;
30
31 // Flag the current page as a contextual search overlay.
32 void SetIsContextualSearchOverlay();
33
34 private:
35 // Add the mojo service to a RenderFrame's service registry.
36 void RegisterMojoService();
37 void CreateOverlayPageNotifierService(
38 mojo::InterfaceRequest<OverlayPageNotifierService> request);
39
40 // Track if the current page is presented in the contextual search overlay.
41 bool is_contextual_search_overlay_;
42
43 base::WeakPtrFactory<OverlayJsRenderFrameObserver> weak_factory_;
44 };
45
46 } // namespace contextual_search
47
48 #endif // COMPONENTS_CONTEXTUAL_SEARCH_OVERLAY_JS_RENDER_FRAME_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698