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