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

Side by Side Diff: content/renderer/java/gin_java_bridge_object.h

Issue 259033002: [Android] Implement renderer side of Gin Java Bridge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed, test added Created 6 years, 7 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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 CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_
6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_
7
8 #include <set>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/renderer/java/gin_java_bridge_dispatcher.h"
13 #include "gin/handle.h"
14 #include "gin/interceptor.h"
15 #include "gin/object_template_builder.h"
16 #include "gin/wrappable.h"
17
18 namespace blink {
19 class WebFrame;
20 }
21
22 namespace content {
23
24 class GinJavaBridgeValueConverter;
25
26 class GinJavaBridgeObject : public gin::Wrappable<GinJavaBridgeObject>,
27 public gin::NamedPropertyInterceptor {
28 public:
29 GinJavaBridgeDispatcher::ObjectID object_id() const { return object_id_; }
30
31 // gin::Wrappable.
32 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
33 v8::Isolate* isolate) OVERRIDE;
34
35 // gin::NamedPropertyInterceptor
36 virtual v8::Local<v8::Value> GetNamedProperty(
37 v8::Isolate* isolate, const std::string& property) OVERRIDE;
38 virtual std::vector<std::string> EnumerateNamedProperties(
39 v8::Isolate* isolate) OVERRIDE;
40
41 static GinJavaBridgeObject* Inject(
jochen (gone - plz use gerrit) 2014/05/05 10:55:49 nit. static members should come first (before obje
mnaganov (inactive) 2014/05/06 10:54:15 I think that is only for static data members. From
42 blink::WebFrame* frame,
43 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher,
44 const std::string& object_name,
45 GinJavaBridgeDispatcher::ObjectID object_id);
46 static GinJavaBridgeObject* InjectAnonymous(
47 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher,
48 GinJavaBridgeDispatcher::ObjectID object_id);
49 static bool InjectExisting(blink::WebFrame* frame,
50 GinJavaBridgeObject* object,
51 const std::string& object_name);
52
53 static gin::WrapperInfo kWrapperInfo;
54
55 private:
56 GinJavaBridgeObject(v8::Isolate* isolate,
57 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher,
58 GinJavaBridgeDispatcher::ObjectID object_id);
59 virtual ~GinJavaBridgeObject();
60
61 v8::Handle<v8::Value> InvokeMethod(const std::string& name,
62 gin::Arguments* args);
63
64 base::WeakPtr<GinJavaBridgeDispatcher> dispatcher_;
65 GinJavaBridgeDispatcher::ObjectID object_id_;
66 scoped_ptr<GinJavaBridgeValueConverter> converter_;
67
68 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeObject);
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698