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

Side by Side Diff: remoting/client/plugin/chromoting_plugin.h

Issue 3064009: Initial scriptable object implementation. (Closed)
Patch Set: Fix alpha's style nits. Created 10 years, 4 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
« no previous file with comments | « remoting/client/client_util_unittest.cc ('k') | remoting/client/plugin/chromoting_plugin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // TODO(ajwong): We need to come up with a better description of the 5 // TODO(ajwong): We need to come up with a better description of the
6 // responsibilities for each thread. 6 // responsibilities for each thread.
7 7
8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_
9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/at_exit.h" 13 #include "base/at_exit.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "remoting/client/client_context.h"
15 #include "remoting/client/host_connection.h" 16 #include "remoting/client/host_connection.h"
16 #include "testing/gtest/include/gtest/gtest_prod.h" 17 #include "testing/gtest/include/gtest/gtest_prod.h"
17 #include "third_party/ppapi/c/pp_event.h" 18 #include "third_party/ppapi/c/pp_event.h"
18 #include "third_party/ppapi/c/pp_instance.h" 19 #include "third_party/ppapi/c/pp_instance.h"
19 #include "third_party/ppapi/c/pp_rect.h" 20 #include "third_party/ppapi/c/pp_rect.h"
20 #include "third_party/ppapi/c/pp_resource.h" 21 #include "third_party/ppapi/c/pp_resource.h"
21 #include "third_party/ppapi/cpp/instance.h" 22 #include "third_party/ppapi/cpp/instance.h"
22 #include "third_party/ppapi/cpp/device_context_2d.h" 23 #include "third_party/ppapi/cpp/device_context_2d.h"
24 #include "third_party/ppapi/cpp/var.h"
23 25
24 class MessageLoop; 26 class MessageLoop;
25 27
26 namespace base { 28 namespace base {
27 class Thread; 29 class Thread;
28 } // namespace base 30 } // namespace base
29 31
30 namespace pp { 32 namespace pp {
31 class Module; 33 class Module;
32 } // namespace pp 34 } // namespace pp
33 35
34 namespace remoting { 36 namespace remoting {
35 37
36 class ChromotingClient; 38 class ChromotingClient;
37 class ClientContext; 39 class ClientContext;
38 class HostConnection; 40 class HostConnection;
39 class InputHandler; 41 class InputHandler;
40 class JingleThread; 42 class JingleThread;
41 class PepperView; 43 class PepperView;
42 44
43 class ChromotingPlugin : public pp::Instance { 45 class ChromotingPlugin : public pp::Instance {
44 public: 46 public:
45 // The mimetype for which this plugin is registered. 47 // The mimetype for which this plugin is registered.
46 static const char *kMimeType; 48 static const char *kMimeType;
47 49
48 ChromotingPlugin(PP_Instance instance); 50 ChromotingPlugin(PP_Instance instance);
49 virtual ~ChromotingPlugin(); 51 virtual ~ChromotingPlugin();
50 52
51 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]); 53 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
54 virtual void Connect(const ClientConfig& config);
52 virtual bool HandleEvent(const PP_Event& event); 55 virtual bool HandleEvent(const PP_Event& event);
53 virtual void ViewChanged(const PP_Rect& position, const PP_Rect& clip); 56 virtual pp::Var GetInstanceObject();
57 virtual void ViewChanged(const pp::Rect& position, const pp::Rect& clip);
54 58
55 virtual bool CurrentlyOnPluginThread() const; 59 virtual bool CurrentlyOnPluginThread() const;
56 60
57 private: 61 private:
58 FRIEND_TEST(ChromotingPluginTest, ParseUrl);
59 FRIEND_TEST(ChromotingPluginTest, TestCaseSetup); 62 FRIEND_TEST(ChromotingPluginTest, TestCaseSetup);
60 63
61 // Since we're an internal plugin, we can just grab the message loop during 64 // Since we're an internal plugin, we can just grab the message loop during
62 // init to figure out which thread we're on. This should only be used to 65 // init to figure out which thread we're on. This should only be used to
63 // sanity check which thread we're executing on. Do not post task here! 66 // sanity check which thread we're executing on. Do not post task here!
64 // Instead, use PPB_Core:CallOnMainThread() in the pepper api. 67 // Instead, use PPB_Core:CallOnMainThread() in the pepper api.
65 // 68 //
66 // TODO(ajwong): Think if there is a better way to safeguard this. 69 // TODO(ajwong): Think if there is a better way to safeguard this.
67 MessageLoop* pepper_main_loop_dont_post_to_me_; 70 MessageLoop* pepper_main_loop_dont_post_to_me_;
68 71
69 scoped_ptr<ClientContext> context_; 72 ClientContext context_;
70
71 scoped_ptr<HostConnection> host_connection_; 73 scoped_ptr<HostConnection> host_connection_;
72
73 scoped_ptr<PepperView> view_; 74 scoped_ptr<PepperView> view_;
74
75 scoped_ptr<InputHandler> input_handler_; 75 scoped_ptr<InputHandler> input_handler_;
76
77 scoped_ptr<ChromotingClient> client_; 76 scoped_ptr<ChromotingClient> client_;
77 pp::Var instance_object_; // JavaScript interface to control this instance.
78 78
79 DISALLOW_COPY_AND_ASSIGN(ChromotingPlugin); 79 DISALLOW_COPY_AND_ASSIGN(ChromotingPlugin);
80 }; 80 };
81 81
82 } // namespace remoting 82 } // namespace remoting
83 83
84 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_ 84 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_PLUGIN_H_
OLDNEW
« no previous file with comments | « remoting/client/client_util_unittest.cc ('k') | remoting/client/plugin/chromoting_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698