Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Unified Diff: content/child/notifications/pending_notification.h

Issue 1847863002: Move notification resource loading from content/child to blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address peter's comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/child/notifications/pending_notification.h
diff --git a/content/child/notifications/pending_notification.h b/content/child/notifications/pending_notification.h
deleted file mode 100644
index dc7036bf004ae7368b77611128c441a3a5895079..0000000000000000000000000000000000000000
--- a/content/child/notifications/pending_notification.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef CONTENT_CHILD_NOTIFICATIONS_PENDING_NOTIFICATION_H_
-#define CONTENT_CHILD_NOTIFICATIONS_PENDING_NOTIFICATION_H_
-
-#include <vector>
-
-#include "base/callback_forward.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "content/child/notifications/notification_image_loader.h"
-#include "third_party/WebKit/public/platform/WebURL.h"
-#include "third_party/WebKit/public/platform/modules/notifications/WebNotificationData.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-}
-
-namespace content {
-
-struct NotificationResources;
-
-// Stores the information associated with a pending notification, and fetches
-// resources for it on the main thread.
-class PendingNotification {
- public:
- explicit PendingNotification(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner);
- ~PendingNotification();
-
- // Fetches all resources asynchronously on the main thread.
- void FetchResources(const blink::WebNotificationData& notification_data,
- const base::Closure& fetches_finished_callback);
-
- // Returns a new NotificationResources populated with the resources that have
- // been fetched.
- NotificationResources GetResources() const;
-
- private:
- // Fetches an image using |image_web_url| asynchronously on the main thread.
- // The |image_callback| will be called on the worker thread.
- void FetchImageResource(const blink::WebURL& image_web_url,
- const ImageLoadCompletedCallback& image_callback);
-
- // To be called on the worker thread when the notification icon has been
- // fetched.
- void DidFetchNotificationIcon(const SkBitmap& bitmap);
-
- // To be called on the worker thread when the badge has been fetched.
- void DidFetchBadge(const SkBitmap& bitmap);
-
- // To be called on the worker thread when an action icon has been fetched.
- void DidFetchActionIcon(size_t action_index, const SkBitmap& bitmap);
-
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
-
- SkBitmap notification_icon_;
-
- SkBitmap badge_;
-
- std::vector<SkBitmap> action_icons_;
-
- base::Closure fetches_finished_barrier_closure_;
-
- std::vector<scoped_refptr<NotificationImageLoader>> image_loaders_;
-
- base::WeakPtrFactory<PendingNotification> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PendingNotification);
-};
-
-} // namespace content
-
-#endif // CONTENT_CHILD_NOTIFICATIONS_PENDING_NOTIFICATION_H_

Powered by Google App Engine
This is Rietveld 408576698