OLD | NEW |
| (Empty) |
1 // Copyright 2010 The Ginsu Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 | |
5 // TODO(c_salt authors): Make this API agnostic. Also maybe don't force it to | |
6 // be a ScriptableNativeObjectInterface. | |
7 | |
8 #include "c_salt/instance.h" | |
9 | |
10 #include "c_salt/npapi/browser_binding.h" | |
11 | |
12 namespace c_salt { | |
13 | |
14 Instance::~Instance() { | |
15 set_is_loaded(false); | |
16 } | |
17 | |
18 void Instance::InitializeMethods(ScriptingBridge* bridge) { | |
19 } | |
20 | |
21 void Instance::InitializeProperties(ScriptingBridge* bridge) { | |
22 } | |
23 | |
24 bool Instance::InstanceDidLoad(int width, int height) { | |
25 return true; | |
26 } | |
27 | |
28 void Instance::WindowDidChangeSize(int width, int height) { | |
29 } | |
30 | |
31 bool Instance::ReceiveEvent(const NPPepperEvent& event) { | |
32 return false; | |
33 } | |
34 | |
35 void Instance::CreateScriptingBridgeForObject( | |
36 SharedScriptableNativeObject native_object) { | |
37 // Create the browser_binding. This is a synchronous call to the Browser. | |
38 c_salt::npapi::BrowserBinding* browser_binding = | |
39 c_salt::npapi::BrowserBinding::CreateBrowserBinding(*this); | |
40 if (browser_binding) { | |
41 SharedScriptingBridge bridge(browser_binding->scripting_bridge()); | |
42 // Tell the ScriptingBridge the object for which it is the bridge. | |
43 bridge->set_native_object(native_object); | |
44 // And initialize the native object with the bridge. This initializes | |
45 // methods and properties and sets the ScriptableNativeObject up with a weak | |
46 // reference back to the ScriptingBridge. | |
47 native_object->Initialize(bridge); | |
48 } | |
49 } | |
50 | |
51 } // namespace c_salt | |
OLD | NEW |