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 "content/child/notifications/notification_image_loader.h" | 5 #include "content/child/notifications/notification_image_loader.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/child/child_thread.h" | 8 #include "content/child/child_thread_impl.h" |
9 #include "content/child/image_decoder.h" | 9 #include "content/child/image_decoder.h" |
10 #include "content/child/worker_task_runner.h" | 10 #include "content/child/worker_task_runner.h" |
11 #include "third_party/WebKit/public/platform/Platform.h" | 11 #include "third_party/WebKit/public/platform/Platform.h" |
12 #include "third_party/WebKit/public/platform/WebURL.h" | 12 #include "third_party/WebKit/public/platform/WebURL.h" |
13 #include "third_party/WebKit/public/platform/WebURLLoader.h" | 13 #include "third_party/WebKit/public/platform/WebURLLoader.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
15 | 15 |
16 using blink::WebURL; | 16 using blink::WebURL; |
17 using blink::WebURLError; | 17 using blink::WebURLError; |
18 using blink::WebURLLoader; | 18 using blink::WebURLLoader; |
19 using blink::WebURLRequest; | 19 using blink::WebURLRequest; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 NotificationImageLoader::NotificationImageLoader( | 23 NotificationImageLoader::NotificationImageLoader( |
24 const NotificationImageLoadedCallback& callback) | 24 const NotificationImageLoadedCallback& callback) |
25 : callback_(callback), | 25 : callback_(callback), |
26 completed_(false) {} | 26 completed_(false) {} |
27 | 27 |
28 NotificationImageLoader::~NotificationImageLoader() {} | 28 NotificationImageLoader::~NotificationImageLoader() {} |
29 | 29 |
30 void NotificationImageLoader::StartOnMainThread(const WebURL& image_url, | 30 void NotificationImageLoader::StartOnMainThread(const WebURL& image_url, |
31 int worker_thread_id) { | 31 int worker_thread_id) { |
32 DCHECK(ChildThread::current()); | 32 DCHECK(ChildThreadImpl::current()); |
33 DCHECK(!url_loader_); | 33 DCHECK(!url_loader_); |
34 | 34 |
35 worker_thread_id_ = worker_thread_id; | 35 worker_thread_id_ = worker_thread_id; |
36 | 36 |
37 WebURLRequest request(image_url); | 37 WebURLRequest request(image_url); |
38 request.setRequestContext(WebURLRequest::RequestContextImage); | 38 request.setRequestContext(WebURLRequest::RequestContextImage); |
39 | 39 |
40 url_loader_.reset(blink::Platform::current()->createURLLoader()); | 40 url_loader_.reset(blink::Platform::current()->createURLLoader()); |
41 url_loader_->loadAsynchronously(request, this); | 41 url_loader_->loadAsynchronously(request, this); |
42 } | 42 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 callback_.Run(loader); | 83 callback_.Run(loader); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 WorkerTaskRunner::Instance()->PostTask( | 87 WorkerTaskRunner::Instance()->PostTask( |
88 worker_thread_id_, | 88 worker_thread_id_, |
89 base::Bind(callback_, loader)); | 89 base::Bind(callback_, loader)); |
90 } | 90 } |
91 | 91 |
92 } // namespace content | 92 } // namespace content |
OLD | NEW |