| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_VIEW_ASH_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_VIEW_ASH_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_VIEW_ASH_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_VIEW_ASH_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/browser/favicon/favicon_download_helper_delegate.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/notifications/balloon.h" | 11 #include "chrome/browser/notifications/balloon.h" |
| 12 | 12 |
| 13 class FaviconDownloadHelper; | 13 class GURL; |
| 14 class SkBitmap; |
| 14 | 15 |
| 15 // On Ash, a "BalloonView" is just a wrapper for ash notification entries. | 16 // On Ash, a "BalloonView" is just a wrapper for ash notification entries. |
| 16 class BalloonViewAsh : public BalloonView, | 17 class BalloonViewAsh : public BalloonView { |
| 17 public FaviconDownloadHelperDelegate { | |
| 18 public: | 18 public: |
| 19 explicit BalloonViewAsh(BalloonCollection* collection); | 19 explicit BalloonViewAsh(BalloonCollection* collection); |
| 20 virtual ~BalloonViewAsh(); | 20 virtual ~BalloonViewAsh(); |
| 21 | 21 |
| 22 // BalloonView interface. | 22 // BalloonView interface. |
| 23 virtual void Show(Balloon* balloon) OVERRIDE; | 23 virtual void Show(Balloon* balloon) OVERRIDE; |
| 24 virtual void Update() OVERRIDE; | 24 virtual void Update() OVERRIDE; |
| 25 virtual void RepositionToBalloon() OVERRIDE; | 25 virtual void RepositionToBalloon() OVERRIDE; |
| 26 virtual void Close(bool by_user) OVERRIDE; | 26 virtual void Close(bool by_user) OVERRIDE; |
| 27 virtual gfx::Size GetSize() const OVERRIDE; | 27 virtual gfx::Size GetSize() const OVERRIDE; |
| 28 virtual BalloonHost* GetHost() const OVERRIDE; | 28 virtual BalloonHost* GetHost() const OVERRIDE; |
| 29 | 29 |
| 30 // FaviconDownloadHelperDelegate interface: | 30 private: |
| 31 virtual void OnDidDownloadFavicon( | 31 // Favicon download callback. |
| 32 void DidDownloadFavicon( |
| 32 int id, | 33 int id, |
| 33 const GURL& image_url, | 34 const GURL& image_url, |
| 34 bool errored, | 35 bool errored, |
| 35 int requested_size, | 36 int requested_size, |
| 36 const std::vector<SkBitmap>& bitmaps) OVERRIDE; | 37 const std::vector<SkBitmap>& bitmaps); |
| 37 | |
| 38 private: | |
| 39 void FetchIcon(const Notification& notification); | 38 void FetchIcon(const Notification& notification); |
| 40 std::string GetExtensionId(Balloon* balloon); | 39 std::string GetExtensionId(Balloon* balloon); |
| 41 | 40 |
| 42 BalloonCollection* collection_; | 41 BalloonCollection* collection_; |
| 43 Balloon* balloon_; | 42 Balloon* balloon_; |
| 44 scoped_ptr<FaviconDownloadHelper> icon_fetcher_; | |
| 45 | 43 |
| 46 // Track the current notification id and download id so that it can be updated | 44 // Track the current notification id and download id so that it can be updated |
| 47 // properly. | 45 // properly. |
| 48 int current_download_id_; | 46 int current_download_id_; |
| 49 std::string current_notification_id_; | 47 std::string current_notification_id_; |
| 50 std::string cached_notification_id_; | 48 std::string cached_notification_id_; |
| 49 base::WeakPtrFactory<BalloonViewAsh> weak_ptr_factory_; |
| 51 | 50 |
| 52 DISALLOW_COPY_AND_ASSIGN(BalloonViewAsh); | 51 DISALLOW_COPY_AND_ASSIGN(BalloonViewAsh); |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_VIEW_ASH_H_ | 54 #endif // CHROME_BROWSER_UI_VIEWS_ASH_BALLOON_VIEW_ASH_H_ |
| OLD | NEW |