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 #include "mojo/services/html_viewer/blink_platform_impl.h" | 5 #include "mojo/services/html_viewer/blink_platform_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "mojo/public/cpp/application/application_impl.h" | 13 #include "mojo/public/cpp/application/application_impl.h" |
| 14 #include "mojo/services/html_viewer/webcookiejar_impl.h" |
14 #include "mojo/services/html_viewer/webthread_impl.h" | 15 #include "mojo/services/html_viewer/webthread_impl.h" |
15 #include "mojo/services/html_viewer/weburlloader_impl.h" | 16 #include "mojo/services/html_viewer/weburlloader_impl.h" |
16 #include "net/base/data_url.h" | 17 #include "net/base/data_url.h" |
17 #include "net/base/mime_util.h" | 18 #include "net/base/mime_util.h" |
18 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
19 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 20 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
20 | 21 |
21 namespace mojo { | 22 namespace mojo { |
22 namespace { | 23 namespace { |
23 | 24 |
(...skipping 22 matching lines...) Expand all Loading... |
46 } // namespace | 47 } // namespace |
47 | 48 |
48 BlinkPlatformImpl::BlinkPlatformImpl(ApplicationImpl* app) | 49 BlinkPlatformImpl::BlinkPlatformImpl(ApplicationImpl* app) |
49 : main_loop_(base::MessageLoop::current()), | 50 : main_loop_(base::MessageLoop::current()), |
50 shared_timer_func_(NULL), | 51 shared_timer_func_(NULL), |
51 shared_timer_fire_time_(0.0), | 52 shared_timer_fire_time_(0.0), |
52 shared_timer_fire_time_was_set_while_suspended_(false), | 53 shared_timer_fire_time_was_set_while_suspended_(false), |
53 shared_timer_suspended_(0), | 54 shared_timer_suspended_(0), |
54 current_thread_slot_(&DestroyCurrentThread) { | 55 current_thread_slot_(&DestroyCurrentThread) { |
55 app->ConnectToService("mojo:mojo_network_service", &network_service_); | 56 app->ConnectToService("mojo:mojo_network_service", &network_service_); |
| 57 |
| 58 CookieStorePtr cookie_store; |
| 59 network_service_->GetCookieStore(Get(&cookie_store)); |
| 60 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); |
56 } | 61 } |
57 | 62 |
58 BlinkPlatformImpl::~BlinkPlatformImpl() { | 63 BlinkPlatformImpl::~BlinkPlatformImpl() { |
59 } | 64 } |
60 | 65 |
| 66 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { |
| 67 return cookie_jar_.get(); |
| 68 } |
| 69 |
61 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { | 70 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { |
62 return &mime_registry_; | 71 return &mime_registry_; |
63 } | 72 } |
64 | 73 |
65 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 74 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
66 return &theme_engine_; | 75 return &theme_engine_; |
67 } | 76 } |
68 | 77 |
69 blink::WebString BlinkPlatformImpl::defaultLocale() { | 78 blink::WebString BlinkPlatformImpl::defaultLocale() { |
70 return blink::WebString::fromUTF8("en-US"); | 79 return blink::WebString::fromUTF8("en-US"); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 215 } |
207 | 216 |
208 // static | 217 // static |
209 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 218 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
210 WebThreadImplForMessageLoop* impl = | 219 WebThreadImplForMessageLoop* impl = |
211 static_cast<WebThreadImplForMessageLoop*>(thread); | 220 static_cast<WebThreadImplForMessageLoop*>(thread); |
212 delete impl; | 221 delete impl; |
213 } | 222 } |
214 | 223 |
215 } // namespace mojo | 224 } // namespace mojo |
OLD | NEW |