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_METRO_PIN_TAB_HELPER_WIN_H_ | 5 #ifndef CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ |
6 #define CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ | 6 #define CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "chrome/browser/favicon/favicon_download_helper.h" | 10 #include "chrome/browser/favicon/favicon_download_helper.h" |
11 #include "chrome/browser/favicon/favicon_download_helper_delegate.h" | 11 #include "chrome/browser/favicon/favicon_download_helper_delegate.h" |
12 #include "chrome/common/favicon_url.h" | |
13 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
14 #include "content/public/browser/web_contents_user_data.h" | 13 #include "content/public/browser/web_contents_user_data.h" |
| 14 #include "content/public/common/favicon_url.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
17 | 17 |
18 // Per-tab class to help manage metro pinning. | 18 // Per-tab class to help manage metro pinning. |
19 class MetroPinTabHelper | 19 class MetroPinTabHelper |
20 : public content::WebContentsObserver, | 20 : public content::WebContentsObserver, |
21 public content::WebContentsUserData<MetroPinTabHelper>, | 21 public content::WebContentsUserData<MetroPinTabHelper>, |
22 public FaviconDownloadHelperDelegate { | 22 public FaviconDownloadHelperDelegate { |
23 public: | 23 public: |
24 virtual ~MetroPinTabHelper(); | 24 virtual ~MetroPinTabHelper(); |
(...skipping 10 matching lines...) Expand all Loading... |
35 private: | 35 private: |
36 // The FaviconDownloader class handles downloading the favicons when a page | 36 // The FaviconDownloader class handles downloading the favicons when a page |
37 // is being pinned. After it has downloaded any available favicons it will | 37 // is being pinned. After it has downloaded any available favicons it will |
38 // continue on with the page pinning action. | 38 // continue on with the page pinning action. |
39 class FaviconChooser; | 39 class FaviconChooser; |
40 | 40 |
41 explicit MetroPinTabHelper(content::WebContents* tab_contents); | 41 explicit MetroPinTabHelper(content::WebContents* tab_contents); |
42 friend class content::WebContentsUserData<MetroPinTabHelper>; | 42 friend class content::WebContentsUserData<MetroPinTabHelper>; |
43 | 43 |
44 // FaviconDownloadHelperDelegate overrides. | 44 // FaviconDownloadHelperDelegate overrides. |
45 void OnUpdateFaviconURL(int32 page_id, | 45 void OnUpdateFaviconURL( |
46 const std::vector<FaviconURL>& candidates) OVERRIDE; | 46 int32 page_id, |
| 47 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
47 | 48 |
48 void OnDidDownloadFavicon(int id, | 49 void OnDidDownloadFavicon(int id, |
49 const GURL& image_url, | 50 const GURL& image_url, |
50 bool errored, | 51 bool errored, |
51 int requested_size, | 52 int requested_size, |
52 const std::vector<SkBitmap>& bitmaps) OVERRIDE; | 53 const std::vector<SkBitmap>& bitmaps) OVERRIDE; |
53 | 54 |
54 void UnPinPageFromStartScreen(); | 55 void UnPinPageFromStartScreen(); |
55 | 56 |
56 // Called by the |favicon_downloader_| when it has finished. | 57 // Called by the |favicon_downloader_| when it has finished. |
57 void FaviconDownloaderFinished(); | 58 void FaviconDownloaderFinished(); |
58 | 59 |
59 // Candidate Favicon URLs for the current page. | 60 // Candidate Favicon URLs for the current page. |
60 std::vector<FaviconURL> favicon_url_candidates_; | 61 std::vector<content::FaviconURL> favicon_url_candidates_; |
61 | 62 |
62 // The currently active FaviconChooser, if there is one. | 63 // The currently active FaviconChooser, if there is one. |
63 scoped_ptr<FaviconChooser> favicon_chooser_; | 64 scoped_ptr<FaviconChooser> favicon_chooser_; |
64 | 65 |
65 // FaviconDownloadHelper handles the sending and listening for IPC messages. | 66 // FaviconDownloadHelper handles the sending and listening for IPC messages. |
66 FaviconDownloadHelper favicon_download_helper_; | 67 FaviconDownloadHelper favicon_download_helper_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); | 69 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); |
69 }; | 70 }; |
70 | 71 |
71 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ | 72 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ |
OLD | NEW |