| 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 WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_IMPL_H_ |
| 6 #define CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ | 6 #define WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_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" | |
| 13 #include "third_party/WebKit/public/platform/Platform.h" | 12 #include "third_party/WebKit/public/platform/Platform.h" |
| 14 #include "third_party/WebKit/public/platform/WebURLError.h" | 13 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 15 #include "ui/base/layout.h" | 14 #include "ui/base/layout.h" |
| 16 #include "webkit/child/resource_loader_bridge.h" | 15 #include "webkit/child/resource_loader_bridge.h" |
| 16 #include "webkit/child/webkit_child_export.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 webkit_glue { |
| 27 | 27 |
| 28 class WebSocketStreamHandleDelegate; | 28 class WebSocketStreamHandleDelegate; |
| 29 class WebSocketStreamHandleBridge; | 29 class WebSocketStreamHandleBridge; |
| 30 | 30 |
| 31 class CONTENT_EXPORT BlinkPlatformImpl | 31 class WEBKIT_CHILD_EXPORT WebKitPlatformSupportImpl : |
| 32 : NON_EXPORTED_BASE(public blink::Platform) { | 32 NON_EXPORTED_BASE(public blink::Platform) { |
| 33 public: | 33 public: |
| 34 BlinkPlatformImpl(); | 34 WebKitPlatformSupportImpl(); |
| 35 virtual ~BlinkPlatformImpl(); | 35 virtual ~WebKitPlatformSupportImpl(); |
| 36 | 36 |
| 37 // Platform methods (partial implementation): | 37 // Platform methods (partial implementation): |
| 38 virtual base::PlatformFile databaseOpenFile( | 38 virtual base::PlatformFile databaseOpenFile( |
| 39 const blink::WebString& vfs_file_name, int desired_flags); | 39 const blink::WebString& vfs_file_name, int desired_flags); |
| 40 virtual int databaseDeleteFile(const blink::WebString& vfs_file_name, | 40 virtual int databaseDeleteFile(const blink::WebString& vfs_file_name, |
| 41 bool sync_dir); | 41 bool sync_dir); |
| 42 virtual long databaseGetFileAttributes( | 42 virtual long databaseGetFileAttributes( |
| 43 const blink::WebString& vfs_file_name); | 43 const blink::WebString& vfs_file_name); |
| 44 virtual long long databaseGetFileSize(const blink::WebString& vfs_file_name); | 44 virtual long long databaseGetFileSize(const blink::WebString& vfs_file_name); |
| 45 virtual long long databaseGetSpaceAvailableForOrigin( | 45 virtual long long databaseGetSpaceAvailableForOrigin( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Gets a localized string given a message id. Returns an empty string if the | 119 // Gets a localized string given a message id. Returns an empty string if the |
| 120 // message id is not found. | 120 // message id is not found. |
| 121 virtual base::string16 GetLocalizedString(int message_id) = 0; | 121 virtual base::string16 GetLocalizedString(int message_id) = 0; |
| 122 | 122 |
| 123 // Returns the raw data for a resource. This resource must have been | 123 // Returns the raw data for a resource. This resource must have been |
| 124 // specified as BINDATA in the relevant .rc file. | 124 // specified as BINDATA in the relevant .rc file. |
| 125 virtual base::StringPiece GetDataResource(int resource_id, | 125 virtual base::StringPiece GetDataResource(int resource_id, |
| 126 ui::ScaleFactor scale_factor) = 0; | 126 ui::ScaleFactor scale_factor) = 0; |
| 127 | 127 |
| 128 // Creates a ResourceLoaderBridge. | 128 // Creates a ResourceLoaderBridge. |
| 129 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( | 129 virtual ResourceLoaderBridge* CreateResourceLoader( |
| 130 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) = 0; | 130 const ResourceLoaderBridge::RequestInfo& request_info) = 0; |
| 131 // Creates a WebSocketStreamHandleBridge. | 131 // Creates a WebSocketStreamHandleBridge. |
| 132 virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( | 132 virtual WebSocketStreamHandleBridge* CreateWebSocketStreamBridge( |
| 133 blink::WebSocketStreamHandle* handle, | 133 blink::WebSocketStreamHandle* handle, |
| 134 WebSocketStreamHandleDelegate* delegate) = 0; | 134 WebSocketStreamHandleDelegate* delegate) = 0; |
| 135 | 135 |
| 136 void SuspendSharedTimer(); | 136 void SuspendSharedTimer(); |
| 137 void ResumeSharedTimer(); | 137 void ResumeSharedTimer(); |
| 138 virtual void OnStartSharedTimer(base::TimeDelta delay) {} | 138 virtual void OnStartSharedTimer(base::TimeDelta delay) {} |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 void DoTimeout() { | 141 void DoTimeout() { |
| 142 if (shared_timer_func_ && !shared_timer_suspended_) | 142 if (shared_timer_func_ && !shared_timer_suspended_) |
| 143 shared_timer_func_(); | 143 shared_timer_func_(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 base::MessageLoop* main_loop_; | 146 base::MessageLoop* main_loop_; |
| 147 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; | 147 base::OneShotTimer<WebKitPlatformSupportImpl> shared_timer_; |
| 148 void (*shared_timer_func_)(); | 148 void (*shared_timer_func_)(); |
| 149 double shared_timer_fire_time_; | 149 double shared_timer_fire_time_; |
| 150 bool shared_timer_fire_time_was_set_while_suspended_; | 150 bool shared_timer_fire_time_was_set_while_suspended_; |
| 151 int shared_timer_suspended_; // counter | 151 int shared_timer_suspended_; // counter |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace webkit_glue |
| 155 | 155 |
| 156 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ | 156 #endif // WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_IMPL_H_ |
| OLD | NEW |