OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ | 5 #ifndef CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ |
6 #define CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ | 6 #define CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "third_party/WebKit/public/platform/Platform.h" | 13 #include "third_party/WebKit/public/platform/Platform.h" |
14 #include "third_party/WebKit/public/platform/WebURLError.h" | 14 #include "third_party/WebKit/public/platform/WebURLError.h" |
15 #include "ui/base/layout.h" | 15 #include "ui/base/layout.h" |
16 #include "webkit/child/resource_loader_bridge.h" | 16 #include "webkit/child/resource_loader_bridge.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class MessageLoop; | 19 class MessageLoop; |
20 } | 20 } |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 class WebSocketStreamHandle; | 23 class WebSocketStreamHandle; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 class WebSocketStreamHandleDelegate; | 28 class WebSocketStreamHandleDelegate; |
29 class WebSocketStreamHandleBridge; | 29 class WebSocketStreamHandleBridge; |
| 30 struct RequestInfo; |
30 | 31 |
31 class CONTENT_EXPORT BlinkPlatformImpl | 32 class CONTENT_EXPORT BlinkPlatformImpl |
32 : NON_EXPORTED_BASE(public blink::Platform) { | 33 : NON_EXPORTED_BASE(public blink::Platform) { |
33 public: | 34 public: |
34 BlinkPlatformImpl(); | 35 BlinkPlatformImpl(); |
35 virtual ~BlinkPlatformImpl(); | 36 virtual ~BlinkPlatformImpl(); |
36 | 37 |
37 // Platform methods (partial implementation): | 38 // Platform methods (partial implementation): |
38 virtual base::PlatformFile databaseOpenFile( | 39 virtual base::PlatformFile databaseOpenFile( |
39 const blink::WebString& vfs_file_name, int desired_flags); | 40 const blink::WebString& vfs_file_name, int desired_flags); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // message id is not found. | 123 // message id is not found. |
123 virtual base::string16 GetLocalizedString(int message_id) = 0; | 124 virtual base::string16 GetLocalizedString(int message_id) = 0; |
124 | 125 |
125 // Returns the raw data for a resource. This resource must have been | 126 // Returns the raw data for a resource. This resource must have been |
126 // specified as BINDATA in the relevant .rc file. | 127 // specified as BINDATA in the relevant .rc file. |
127 virtual base::StringPiece GetDataResource(int resource_id, | 128 virtual base::StringPiece GetDataResource(int resource_id, |
128 ui::ScaleFactor scale_factor) = 0; | 129 ui::ScaleFactor scale_factor) = 0; |
129 | 130 |
130 // Creates a ResourceLoaderBridge. | 131 // Creates a ResourceLoaderBridge. |
131 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( | 132 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( |
132 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) = 0; | 133 const RequestInfo& request_info) = 0; |
133 // Creates a WebSocketStreamHandleBridge. | 134 // Creates a WebSocketStreamHandleBridge. |
134 virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( | 135 virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( |
135 blink::WebSocketStreamHandle* handle, | 136 blink::WebSocketStreamHandle* handle, |
136 WebSocketStreamHandleDelegate* delegate) = 0; | 137 WebSocketStreamHandleDelegate* delegate) = 0; |
137 | 138 |
138 void SuspendSharedTimer(); | 139 void SuspendSharedTimer(); |
139 void ResumeSharedTimer(); | 140 void ResumeSharedTimer(); |
140 virtual void OnStartSharedTimer(base::TimeDelta delay) {} | 141 virtual void OnStartSharedTimer(base::TimeDelta delay) {} |
141 | 142 |
142 private: | 143 private: |
143 void DoTimeout() { | 144 void DoTimeout() { |
144 if (shared_timer_func_ && !shared_timer_suspended_) | 145 if (shared_timer_func_ && !shared_timer_suspended_) |
145 shared_timer_func_(); | 146 shared_timer_func_(); |
146 } | 147 } |
147 | 148 |
148 base::MessageLoop* main_loop_; | 149 base::MessageLoop* main_loop_; |
149 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; | 150 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; |
150 void (*shared_timer_func_)(); | 151 void (*shared_timer_func_)(); |
151 double shared_timer_fire_time_; | 152 double shared_timer_fire_time_; |
152 bool shared_timer_fire_time_was_set_while_suspended_; | 153 bool shared_timer_fire_time_was_set_while_suspended_; |
153 int shared_timer_suspended_; // counter | 154 int shared_timer_suspended_; // counter |
154 }; | 155 }; |
155 | 156 |
156 } // namespace content | 157 } // namespace content |
157 | 158 |
158 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ | 159 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ |
OLD | NEW |