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

Side by Side Diff: components/contextual_search/renderer/contextual_search_wrapper.h

Issue 1385663002: [Contextual Search] Add Mojo-enabled API component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a second parameter to the setCaption API call. 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_RENDERER_CONTEXTUAL_SEARCH_WRAPPER_H_
6 #define COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_CONTEXTUAL_SEARCH_WRAPPER_H_
7
8 #include "base/basictypes.h"
9 #include "components/contextual_search/common/contextual_search_js_api_service.m ojom.h"
10 #include "content/public/renderer/render_frame.h"
11 #include "gin/wrappable.h"
12
13 namespace blink {
14 class WebFrame;
15 }
16
17 namespace gin {
18 class Arguments;
19 }
20
21 namespace contextual_search {
22
23 // Wrapper for injecting Contextual Search JavaScript
24 // into a WebFrame.
25 class ContextualSearchWrapper : public gin::Wrappable<ContextualSearchWrapper> {
26 public:
27 // Installs Contextual Search JavaScript.
28 static void Install(content::RenderFrame* render_frame);
29
30 // Required by gin::Wrappable.
31 static gin::WrapperInfo kWrapperInfo;
32
33 private:
34 // Intantiate by calling Install.
35 ContextualSearchWrapper(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.
36 ~ContextualSearchWrapper() override;
37
38 // gin::Wrappable.
39 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
40 v8::Isolate* isolate) final;
41
42 // Called by JavaScript to set the caption , and indicate whether
43 // the caption provides an answer (e.g. an actual definition), rather than
44 // just general notification of what kind of answer may be available.
45 void SetCaption(const std::string& caption, bool does_answer);
46
47 // Helper function to ensure that this class has connected to the API service.
48 void EnsureServiceConnected();
49
50 // The render frame that this wrapper is bound to.
51 content::RenderFrame* render_frame_;
52
53 // The service to notify when API calls are made.
54 ContextualSearchJsApiServicePtr contextual_search_js_api_service_;
55
56 DISALLOW_COPY_AND_ASSIGN(ContextualSearchWrapper);
57 };
58
59 } // namespace contextual_search
60
61 #endif // COMPONENTS_CONTEXTUAL_SEARCH_RENDERER_CONTEXTUAL_SEARCH_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698