| Index: content/child/notifications/notification_sound_loader.cc
|
| diff --git a/content/child/notifications/notification_image_loader.cc b/content/child/notifications/notification_sound_loader.cc
|
| similarity index 79%
|
| copy from content/child/notifications/notification_image_loader.cc
|
| copy to content/child/notifications/notification_sound_loader.cc
|
| index 0478188de4f0d3ed82529a637befd8f7f6b9fa3d..62ed760d37cc25c807208e65834356386e989713 100644
|
| --- a/content/child/notifications/notification_image_loader.cc
|
| +++ b/content/child/notifications/notification_sound_loader.cc
|
| @@ -1,8 +1,8 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/child/notifications/notification_image_loader.h"
|
| +#include "content/child/notifications/notification_sound_loader.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/thread_task_runner_handle.h"
|
| @@ -21,20 +21,20 @@ using blink::WebURLRequest;
|
|
|
| namespace content {
|
|
|
| -NotificationImageLoader::NotificationImageLoader(
|
| - const ImageLoadCompletedCallback& callback,
|
| +NotificationSoundLoader::NotificationSoundLoader(
|
| + const SoundLoadCompletedCallback& callback,
|
| const scoped_refptr<base::SingleThreadTaskRunner>& worker_task_runner)
|
| : callback_(callback),
|
| worker_task_runner_(worker_task_runner),
|
| notification_id_(0),
|
| completed_(false) {}
|
|
|
| -NotificationImageLoader::~NotificationImageLoader() {
|
| +NotificationSoundLoader::~NotificationSoundLoader() {
|
| if (main_thread_task_runner_)
|
| DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
|
| }
|
|
|
| -void NotificationImageLoader::StartOnMainThread(int notification_id,
|
| +void NotificationSoundLoader::StartOnMainThread(int notification_id,
|
| const GURL& image_url) {
|
| DCHECK(ChildThreadImpl::current());
|
| DCHECK(!url_loader_);
|
| @@ -50,7 +50,7 @@ void NotificationImageLoader::StartOnMainThread(int notification_id,
|
| url_loader_->loadAsynchronously(request, this);
|
| }
|
|
|
| -void NotificationImageLoader::didReceiveData(
|
| +void NotificationSoundLoader::didReceiveData(
|
| WebURLLoader* loader,
|
| const char* data,
|
| int data_length,
|
| @@ -61,7 +61,7 @@ void NotificationImageLoader::didReceiveData(
|
| buffer_.insert(buffer_.end(), data, data + data_length);
|
| }
|
|
|
| -void NotificationImageLoader::didFinishLoading(
|
| +void NotificationSoundLoader::didFinishLoading(
|
| WebURLLoader* loader,
|
| double finish_time,
|
| int64_t total_encoded_data_length) {
|
| @@ -70,7 +70,7 @@ void NotificationImageLoader::didFinishLoading(
|
| RunCallbackOnWorkerThread();
|
| }
|
|
|
| -void NotificationImageLoader::didFail(WebURLLoader* loader,
|
| +void NotificationSoundLoader::didFail(WebURLLoader* loader,
|
| const WebURLError& error) {
|
| if (completed_)
|
| return;
|
| @@ -78,7 +78,7 @@ void NotificationImageLoader::didFail(WebURLLoader* loader,
|
| RunCallbackOnWorkerThread();
|
| }
|
|
|
| -void NotificationImageLoader::RunCallbackOnWorkerThread() {
|
| +void NotificationSoundLoader::RunCallbackOnWorkerThread() {
|
| url_loader_.reset();
|
|
|
| completed_ = true;
|
| @@ -92,7 +92,7 @@ void NotificationImageLoader::RunCallbackOnWorkerThread() {
|
| }
|
| }
|
|
|
| -SkBitmap NotificationImageLoader::GetDecodedImage() const {
|
| +SkBitmap NotificationSoundLoader::GetDecodedImage() const {
|
| DCHECK(completed_);
|
| if (buffer_.empty())
|
| return SkBitmap();
|
| @@ -101,7 +101,7 @@ SkBitmap NotificationImageLoader::GetDecodedImage() const {
|
| return decoder.Decode(&buffer_[0], buffer_.size());
|
| }
|
|
|
| -void NotificationImageLoader::DeleteOnCorrectThread() const {
|
| +void NotificationSoundLoader::DeleteOnCorrectThread() const {
|
| if (!ChildThreadImpl::current()) {
|
| main_thread_task_runner_->DeleteSoon(FROM_HERE, this);
|
| return;
|
|
|