Repurpose NotificationBitmapFetcher to BitmapFetcher

There was nothing specific about this class, so I'm generalizing it and moving it upwards in the tree for more use cases (e.g. app banners).

Code that will use it is not ready for review, but is located at https://chromiumcodereview.appspot.com/156343002/

BUG=341556

Review URL: https://codereview.chromium.org/155273002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251308 0039d316-1c4b-4281-b951-d872f2087c98
parent df0374d6
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher.h" #include "chrome/browser/bitmap_fetcher.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/url_request/url_fetcher.h" #include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h" #include "net/url_request/url_request_status.h"
namespace notifier { namespace chrome {
NotificationBitmapFetcher::NotificationBitmapFetcher( BitmapFetcher::BitmapFetcher(const GURL& url,
const GURL& url, BitmapFetcherDelegate* delegate)
NotificationBitmapFetcherDelegate* delegate) : url_(url),
: url_(url), delegate_(delegate) {} delegate_(delegate) {
}
NotificationBitmapFetcher::~NotificationBitmapFetcher() {} BitmapFetcher::~BitmapFetcher() {}
void NotificationBitmapFetcher::Start(Profile* profile) { void BitmapFetcher::Start(Profile* profile) {
url_fetcher_.reset( DCHECK(url_fetcher_ == NULL);
net::URLFetcher::Create(url_, net::URLFetcher::GET, this)); url_fetcher_.reset(net::URLFetcher::Create(url_, net::URLFetcher::GET, this));
// The RequestContext is coming from the current profile.
// TODO(petewil): Make sure this is the right profile to use.
// It seems to work, but we might prefer to use a blank profile with
// no cookies.
url_fetcher_->SetRequestContext(profile->GetRequestContext()); url_fetcher_->SetRequestContext(profile->GetRequestContext());
url_fetcher_->Start(); url_fetcher_->Start();
} }
// Methods inherited from URLFetcherDelegate. // Methods inherited from URLFetcherDelegate.
void NotificationBitmapFetcher::OnURLFetchComplete( void BitmapFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
const net::URLFetcher* source) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) { if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) {
OnDecodeImageFailed(NULL); ReportFailure();
return; return;
} }
std::string image_data; std::string image_data;
source->GetResponseAsString(&image_data); source->GetResponseAsString(&image_data);
// Create an ImageDecoder with the data and assign it to the refptr. image_decoder_ =
image_decoder_ = new ImageDecoder(this, image_data, new ImageDecoder(this, image_data, ImageDecoder::DEFAULT_CODEC);
ImageDecoder::DEFAULT_CODEC);
// Call start to begin decoding. The ImageDecoder will call OnImageDecoded // Call start to begin decoding. The ImageDecoder will call OnImageDecoded
// with the data when it is done. // with the data when it is done.
...@@ -54,28 +49,30 @@ void NotificationBitmapFetcher::OnURLFetchComplete( ...@@ -54,28 +49,30 @@ void NotificationBitmapFetcher::OnURLFetchComplete(
image_decoder_->Start(task_runner); image_decoder_->Start(task_runner);
} }
void NotificationBitmapFetcher::OnURLFetchDownloadProgress( void BitmapFetcher::OnURLFetchDownloadProgress(const net::URLFetcher* source,
const net::URLFetcher* source, int64 current, int64 total) { int64 current,
int64 total) {
// Do nothing here. // Do nothing here.
} }
// Methods inherited from ImageDecoder::Delegate. // Methods inherited from ImageDecoder::Delegate.
void NotificationBitmapFetcher::OnImageDecoded( void BitmapFetcher::OnImageDecoded(const ImageDecoder* decoder,
const ImageDecoder* decoder, const SkBitmap& decoded_image) { const SkBitmap& decoded_image) {
// Make a copy of the bitmap which we pass back to the UI thread. // Make a copy of the bitmap which we pass back to the UI thread.
bitmap_.reset(new SkBitmap()); scoped_ptr<SkBitmap> bitmap(new SkBitmap());
decoded_image.deepCopyTo(bitmap_.get(), decoded_image.getConfig()); decoded_image.deepCopyTo(bitmap.get(), decoded_image.getConfig());
// Report success. // Report success.
delegate_->OnFetchComplete(url_, bitmap_.get()); delegate_->OnFetchComplete(url_, bitmap.get());
} }
void NotificationBitmapFetcher::OnDecodeImageFailed( void BitmapFetcher::OnDecodeImageFailed(const ImageDecoder* decoder) {
const ImageDecoder* decoder) { ReportFailure();
}
// Report failure. void BitmapFetcher::ReportFailure() {
delegate_->OnFetchComplete(url_, NULL); delegate_->OnFetchComplete(url_, NULL);
} }
} // namespace notifier } // namespace chrome
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_NOTIFICATION_BITMAP_FETCHER_H_ #ifndef CHROME_BROWSER_BITMAP_FETCHER_H_
#define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_NOTIFICATION_BITMAP_FETCHER_H_ #define CHROME_BROWSER_BITMAP_FETCHER_H_
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "chrome/browser/bitmap_fetcher_delegate.h"
#include "chrome/browser/image_decoder.h" #include "chrome/browser/image_decoder.h"
#include "net/url_request/url_fetcher_delegate.h" #include "net/url_request/url_fetcher_delegate.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
...@@ -17,33 +18,20 @@ class URLFetcher; ...@@ -17,33 +18,20 @@ class URLFetcher;
class Profile; class Profile;
namespace notifier { namespace chrome {
// A delegate interface for users of NotificationBitmapFetcher. // Asynchrounously fetches an image from the given URL and returns the
class NotificationBitmapFetcherDelegate { // decoded Bitmap to the provided BitmapFetcherDelegate.
class BitmapFetcher : public net::URLFetcherDelegate,
public ImageDecoder::Delegate {
public: public:
// This will be called when the bitmap has been requested, whether or not the BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate);
// request succeeds. |url| is the URL that was originally fetched so we can virtual ~BitmapFetcher();
// match up the bitmap with a specific request.
virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) = 0;
protected: const GURL& url() const { return url_; }
virtual ~NotificationBitmapFetcherDelegate() {}
};
class NotificationBitmapFetcher
: public net::URLFetcherDelegate,
public ImageDecoder::Delegate {
public:
NotificationBitmapFetcher(
const GURL& url,
NotificationBitmapFetcherDelegate* delegate);
virtual ~NotificationBitmapFetcher();
GURL url() const { return url_; } // Start fetching the URL with the fetcher. The delegate is notified
// asynchronously when done.
// Start fetching the URL with the fetcher. The operation will be continued
// in the OnURLFetchComplete callback.
void Start(Profile* profile); void Start(Profile* profile);
// Methods inherited from URLFetcherDelegate // Methods inherited from URLFetcherDelegate
...@@ -56,7 +44,8 @@ class NotificationBitmapFetcher ...@@ -56,7 +44,8 @@ class NotificationBitmapFetcher
// denotes the number of bytes received up to the call, and |total| is the // denotes the number of bytes received up to the call, and |total| is the
// expected total size of the response (or -1 if not determined). // expected total size of the response (or -1 if not determined).
virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source,
int64 current, int64 total) OVERRIDE; int64 current,
int64 total) OVERRIDE;
// Methods inherited from ImageDecoder::Delegate // Methods inherited from ImageDecoder::Delegate
...@@ -70,15 +59,17 @@ class NotificationBitmapFetcher ...@@ -70,15 +59,17 @@ class NotificationBitmapFetcher
virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE;
private: private:
// Alerts the delegate that a failure occurred.
void ReportFailure();
scoped_ptr<net::URLFetcher> url_fetcher_; scoped_ptr<net::URLFetcher> url_fetcher_;
scoped_refptr<ImageDecoder> image_decoder_; scoped_refptr<ImageDecoder> image_decoder_;
const GURL url_; const GURL url_;
scoped_ptr<SkBitmap> bitmap_; BitmapFetcherDelegate* const delegate_;
NotificationBitmapFetcherDelegate* const delegate_;
DISALLOW_COPY_AND_ASSIGN(NotificationBitmapFetcher); DISALLOW_COPY_AND_ASSIGN(BitmapFetcher);
}; };
} // namespace notifier } // namespace chrome
#endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_NOTIFICATION_BITMAP_FETCHER_H_ #endif // CHROME_BROWSER_BITMAP_FETCHER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher.h" #include "chrome/browser/bitmap_fetcher.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -23,20 +23,17 @@ const bool kAsyncCall = true; ...@@ -23,20 +23,17 @@ const bool kAsyncCall = true;
const bool kSyncCall = false; const bool kSyncCall = false;
} // namespace } // namespace
namespace notifier { namespace chrome {
// Class to catch events from the NotificationBitmapFetcher for testing. // Class to catch events from the BitmapFetcher for testing.
class NotificationBitmapFetcherTestDelegate class BitmapFetcherTestDelegate : public BitmapFetcherDelegate {
: public NotificationBitmapFetcherDelegate {
public: public:
explicit NotificationBitmapFetcherTestDelegate(bool async) explicit BitmapFetcherTestDelegate(bool async)
: called_(false), success_(false), async_(async) {} : called_(false), success_(false), async_(async) {}
virtual ~NotificationBitmapFetcherTestDelegate() { virtual ~BitmapFetcherTestDelegate() { EXPECT_TRUE(called_); }
EXPECT_TRUE(called_);
}
// Method inherited from NotificationBitmapFetcherDelegate. // Method inherited from BitmapFetcherDelegate.
virtual void OnFetchComplete(const GURL url, virtual void OnFetchComplete(const GURL url,
const SkBitmap* bitmap) OVERRIDE { const SkBitmap* bitmap) OVERRIDE {
called_ = true; called_ = true;
...@@ -63,10 +60,10 @@ class NotificationBitmapFetcherTestDelegate ...@@ -63,10 +60,10 @@ class NotificationBitmapFetcherTestDelegate
bool async_; bool async_;
SkBitmap bitmap_; SkBitmap bitmap_;
DISALLOW_COPY_AND_ASSIGN(NotificationBitmapFetcherTestDelegate); DISALLOW_COPY_AND_ASSIGN(BitmapFetcherTestDelegate);
}; };
class NotificationBitmapFetcherBrowserTest : public InProcessBrowserTest { class BitmapFetcherBrowserTest : public InProcessBrowserTest {
public: public:
virtual void SetUp() OVERRIDE { virtual void SetUp() OVERRIDE {
url_fetcher_factory_.reset(new net::FakeURLFetcherFactory(NULL)); url_fetcher_factory_.reset(new net::FakeURLFetcherFactory(NULL));
...@@ -87,8 +84,7 @@ class NotificationBitmapFetcherBrowserTest : public InProcessBrowserTest { ...@@ -87,8 +84,7 @@ class NotificationBitmapFetcherBrowserTest : public InProcessBrowserTest {
// --single-process. The reason is that the sandbox does not get created // --single-process. The reason is that the sandbox does not get created
// for us by the test process if --single-process is used. // for us by the test process if --single-process is used.
IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, IN_PROC_BROWSER_TEST_F(BitmapFetcherBrowserTest, MAYBE_StartTest) {
MAYBE_StartTest) {
GURL url("http://example.com/this-should-work"); GURL url("http://example.com/this-should-work");
// Put some realistic looking bitmap data into the url_fetcher. // Put some realistic looking bitmap data into the url_fetcher.
...@@ -107,12 +103,12 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, ...@@ -107,12 +103,12 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
std::string image_string(compressed.begin(), compressed.end()); std::string image_string(compressed.begin(), compressed.end());
// Set up a delegate to wait for the callback. // Set up a delegate to wait for the callback.
NotificationBitmapFetcherTestDelegate delegate(kAsyncCall); BitmapFetcherTestDelegate delegate(kAsyncCall);
NotificationBitmapFetcher fetcher(url, &delegate); BitmapFetcher fetcher(url, &delegate);
url_fetcher_factory_->SetFakeResponse(url, image_string, net::HTTP_OK, url_fetcher_factory_->SetFakeResponse(
net::URLRequestStatus::SUCCESS); url, image_string, net::HTTP_OK, net::URLRequestStatus::SUCCESS);
// We expect that the image decoder will get called and return // We expect that the image decoder will get called and return
// an image in a callback to OnImageDecoded(). // an image in a callback to OnImageDecoded().
...@@ -128,8 +124,7 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, ...@@ -128,8 +124,7 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
EXPECT_TRUE(gfx::BitmapsAreEqual(image, found_image)); EXPECT_TRUE(gfx::BitmapsAreEqual(image, found_image));
} }
IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, IN_PROC_BROWSER_TEST_F(BitmapFetcherBrowserTest, OnImageDecodedTest) {
OnImageDecodedTest) {
GURL url("http://example.com/this-should-work-as-well"); GURL url("http://example.com/this-should-work-as-well");
SkBitmap image; SkBitmap image;
...@@ -138,9 +133,9 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, ...@@ -138,9 +133,9 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
image.allocPixels(); image.allocPixels();
image.eraseColor(SK_ColorGREEN); image.eraseColor(SK_ColorGREEN);
NotificationBitmapFetcherTestDelegate delegate(kSyncCall); BitmapFetcherTestDelegate delegate(kSyncCall);
NotificationBitmapFetcher fetcher(url, &delegate); BitmapFetcher fetcher(url, &delegate);
fetcher.OnImageDecoded(NULL, image); fetcher.OnImageDecoded(NULL, image);
...@@ -151,16 +146,15 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, ...@@ -151,16 +146,15 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
EXPECT_TRUE(gfx::BitmapsAreEqual(image, delegate.bitmap())); EXPECT_TRUE(gfx::BitmapsAreEqual(image, delegate.bitmap()));
} }
IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, IN_PROC_BROWSER_TEST_F(BitmapFetcherBrowserTest, OnURLFetchFailureTest) {
OnURLFetchFailureTest) {
GURL url("http://example.com/this-should-be-fetch-failure"); GURL url("http://example.com/this-should-be-fetch-failure");
// We intentionally put no data into the bitmap to simulate a failure. // We intentionally put no data into the bitmap to simulate a failure.
// Set up a delegate to wait for the callback. // Set up a delegate to wait for the callback.
NotificationBitmapFetcherTestDelegate delegate(kAsyncCall); BitmapFetcherTestDelegate delegate(kAsyncCall);
NotificationBitmapFetcher fetcher(url, &delegate); BitmapFetcher fetcher(url, &delegate);
url_fetcher_factory_->SetFakeResponse(url, url_fetcher_factory_->SetFakeResponse(url,
std::string(), std::string(),
...@@ -182,14 +176,14 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, ...@@ -182,14 +176,14 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
#define MAYBE_HandleImageFailedTest HandleImageFailedTest #define MAYBE_HandleImageFailedTest HandleImageFailedTest
#endif #endif
IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, IN_PROC_BROWSER_TEST_F(BitmapFetcherBrowserTest, MAYBE_HandleImageFailedTest) {
MAYBE_HandleImageFailedTest) {
GURL url("http://example.com/this-should-be-a-decode-failure"); GURL url("http://example.com/this-should-be-a-decode-failure");
NotificationBitmapFetcherTestDelegate delegate(kAsyncCall); BitmapFetcherTestDelegate delegate(kAsyncCall);
NotificationBitmapFetcher fetcher(url, &delegate); BitmapFetcher fetcher(url, &delegate);
url_fetcher_factory_->SetFakeResponse( url_fetcher_factory_->SetFakeResponse(url,
url, std::string("Not a real bitmap"), std::string("Not a real bitmap"),
net::HTTP_OK, net::URLRequestStatus::SUCCESS); net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
fetcher.Start(browser()->profile()); fetcher.Start(browser()->profile());
...@@ -199,4 +193,4 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest, ...@@ -199,4 +193,4 @@ IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
EXPECT_FALSE(delegate.success()); EXPECT_FALSE(delegate.success());
} }
} // namespace notifier } // namespace chrome
// Copyright 2014 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 CHROME_BROWSER_BITMAP_FETCHER_DELEGATE_H_
#define CHROME_BROWSER_BITMAP_FETCHER_DELEGATE_H_
#include "url/gurl.h"
class SkBitmap;
namespace chrome {
// A delegate interface for users of BitmapFetcher.
class BitmapFetcherDelegate {
public:
BitmapFetcherDelegate() {}
// This will be called when the bitmap has been requested, whether or not the
// request succeeds. |url| is the URL that was originally fetched so we can
// match up the bitmap with a specific request. |bitmap| may be NULL if the
// image fails to be downloaded or decoded.
virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) = 0;
protected:
virtual ~BitmapFetcherDelegate() {}
DISALLOW_COPY_AND_ASSIGN(BitmapFetcherDelegate);
};
} // namespace chrome
#endif // CHROME_BROWSER_BITMAP_FETCHER_DELEGATE_H_
...@@ -211,7 +211,7 @@ void SyncedNotification::QueueBitmapFetchJobs( ...@@ -211,7 +211,7 @@ void SyncedNotification::QueueBitmapFetchJobs(
void SyncedNotification::StartBitmapFetch() { void SyncedNotification::StartBitmapFetch() {
// Now that we have queued and counted them all, start the fetching. // Now that we have queued and counted them all, start the fetching.
ScopedVector<NotificationBitmapFetcher>::iterator iter; ScopedVector<chrome::BitmapFetcher>::iterator iter;
for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) { for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) {
(*iter)->Start(profile_); (*iter)->Start(profile_);
} }
...@@ -219,14 +219,14 @@ void SyncedNotification::StartBitmapFetch() { ...@@ -219,14 +219,14 @@ void SyncedNotification::StartBitmapFetch() {
void SyncedNotification::AddBitmapToFetchQueue(const GURL& url) { void SyncedNotification::AddBitmapToFetchQueue(const GURL& url) {
// Check for dups, ignore any request for a dup. // Check for dups, ignore any request for a dup.
ScopedVector<NotificationBitmapFetcher>::iterator iter; ScopedVector<chrome::BitmapFetcher>::iterator iter;
for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) { for (iter = fetchers_.begin(); iter != fetchers_.end(); ++iter) {
if ((*iter)->url() == url) if ((*iter)->url() == url)
return; return;
} }
if (url.is_valid()) { if (url.is_valid()) {
fetchers_.push_back(new NotificationBitmapFetcher(url, this)); fetchers_.push_back(new chrome::BitmapFetcher(url, this));
DVLOG(2) << __FUNCTION__ << "Pushing bitmap " << url; DVLOG(2) << __FUNCTION__ << "Pushing bitmap " << url;
} }
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
#include "chrome/browser/notifications/sync_notifier/notification_bitmap_fetcher.h" #include "chrome/browser/bitmap_fetcher.h"
#include "sync/api/sync_data.h" #include "sync/api/sync_data.h"
#include "sync/protocol/sync.pb.h" #include "sync/protocol/sync.pb.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
...@@ -31,7 +31,7 @@ namespace notifier { ...@@ -31,7 +31,7 @@ namespace notifier {
class ChromeNotifierService; class ChromeNotifierService;
class SyncedNotification : public NotificationBitmapFetcherDelegate { class SyncedNotification : public chrome::BitmapFetcherDelegate {
public: public:
explicit SyncedNotification(const syncer::SyncData& sync_data); explicit SyncedNotification(const syncer::SyncData& sync_data);
...@@ -110,7 +110,7 @@ class SyncedNotification : public NotificationBitmapFetcherDelegate { ...@@ -110,7 +110,7 @@ class SyncedNotification : public NotificationBitmapFetcherDelegate {
// Helper function to mark a notification as read or dismissed. // Helper function to mark a notification as read or dismissed.
void SetReadState(const ReadState& read_state); void SetReadState(const ReadState& read_state);
// Method inherited from NotificationBitmapFetcher delegate. // Method inherited from BitmapFetcher delegate.
virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) OVERRIDE; virtual void OnFetchComplete(const GURL url, const SkBitmap* bitmap) OVERRIDE;
// If this bitmap has a valid GURL, create a fetcher for it. // If this bitmap has a valid GURL, create a fetcher for it.
...@@ -124,7 +124,7 @@ class SyncedNotification : public NotificationBitmapFetcherDelegate { ...@@ -124,7 +124,7 @@ class SyncedNotification : public NotificationBitmapFetcherDelegate {
ChromeNotifierService* notifier_service_; ChromeNotifierService* notifier_service_;
Profile* profile_; Profile* profile_;
bool toast_state_; bool toast_state_;
ScopedVector<NotificationBitmapFetcher> fetchers_; ScopedVector<chrome::BitmapFetcher> fetchers_;
gfx::Image app_icon_bitmap_; gfx::Image app_icon_bitmap_;
gfx::Image sender_bitmap_; gfx::Image sender_bitmap_;
gfx::Image image_bitmap_; gfx::Image image_bitmap_;
......
...@@ -289,6 +289,9 @@ ...@@ -289,6 +289,9 @@
'browser/background/background_mode_manager_gtk.cc', 'browser/background/background_mode_manager_gtk.cc',
'browser/background/background_mode_manager_mac.mm', 'browser/background/background_mode_manager_mac.mm',
'browser/background/background_mode_manager_win.cc', 'browser/background/background_mode_manager_win.cc',
'browser/bitmap_fetcher.cc',
'browser/bitmap_fetcher.h',
'browser/bitmap_fetcher_delegate.h',
'browser/bookmarks/base_bookmark_model_observer.cc', 'browser/bookmarks/base_bookmark_model_observer.cc',
'browser/bookmarks/base_bookmark_model_observer.h', 'browser/bookmarks/base_bookmark_model_observer.h',
'browser/bookmarks/bookmark_codec.cc', 'browser/bookmarks/bookmark_codec.cc',
...@@ -1432,8 +1435,6 @@ ...@@ -1432,8 +1435,6 @@
'browser/notifications/sync_notifier/chrome_notifier_service.h', 'browser/notifications/sync_notifier/chrome_notifier_service.h',
'browser/notifications/sync_notifier/chrome_notifier_service_factory.cc', 'browser/notifications/sync_notifier/chrome_notifier_service_factory.cc',
'browser/notifications/sync_notifier/chrome_notifier_service_factory.h', 'browser/notifications/sync_notifier/chrome_notifier_service_factory.h',
'browser/notifications/sync_notifier/notification_bitmap_fetcher.cc',
'browser/notifications/sync_notifier/notification_bitmap_fetcher.h',
'browser/notifications/sync_notifier/synced_notification.cc', 'browser/notifications/sync_notifier/synced_notification.cc',
'browser/notifications/sync_notifier/synced_notification.h', 'browser/notifications/sync_notifier/synced_notification.h',
'browser/notifications/sync_notifier/welcome_delegate.cc', 'browser/notifications/sync_notifier/welcome_delegate.cc',
......
...@@ -1005,6 +1005,7 @@ ...@@ -1005,6 +1005,7 @@
'browser/autofill/autofill_driver_impl_browsertest.cc', 'browser/autofill/autofill_driver_impl_browsertest.cc',
'browser/autofill/form_structure_browsertest.cc', 'browser/autofill/form_structure_browsertest.cc',
'browser/autofill/risk/fingerprint_browsertest.cc', 'browser/autofill/risk/fingerprint_browsertest.cc',
'browser/bitmap_fetcher_browsertest.cc',
'browser/browser_encoding_browsertest.cc', 'browser/browser_encoding_browsertest.cc',
'browser/browsing_data/browsing_data_database_helper_browsertest.cc', 'browser/browsing_data/browsing_data_database_helper_browsertest.cc',
'browser/browsing_data/browsing_data_helper_browsertest.h', 'browser/browsing_data/browsing_data_helper_browsertest.h',
...@@ -1364,7 +1365,6 @@ ...@@ -1364,7 +1365,6 @@
'browser/net/websocket_browsertest.cc', 'browser/net/websocket_browsertest.cc',
'browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc', 'browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc',
'browser/notifications/message_center_notifications_browsertest.cc', 'browser/notifications/message_center_notifications_browsertest.cc',
'browser/notifications/sync_notifier/notification_bitmap_fetcher_browsertest.cc',
'browser/notifications/sync_notifier/sync_notifier_test_utils.cc', 'browser/notifications/sync_notifier/sync_notifier_test_utils.cc',
'browser/notifications/sync_notifier/sync_notifier_test_utils.h', 'browser/notifications/sync_notifier/sync_notifier_test_utils.h',
'browser/password_manager/password_manager_browsertest.cc', 'browser/password_manager/password_manager_browsertest.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment