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 "content/public/child/resource_loader_bridge.h" |
13 #include "third_party/WebKit/public/platform/Platform.h" | 14 #include "third_party/WebKit/public/platform/Platform.h" |
14 #include "third_party/WebKit/public/platform/WebURLError.h" | 15 #include "third_party/WebKit/public/platform/WebURLError.h" |
15 #include "ui/base/layout.h" | 16 #include "ui/base/layout.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 { |
(...skipping 92 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<BlinkPlatformImpl> 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 content |
155 | 155 |
156 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ | 156 #endif // CONTENT_CHILD_BLINK_PLATFORM_IMPL_H_ |
OLD | NEW |