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

Side by Side Diff: chrome/browser/ui/metro_pin_tab_helper_win.h

Issue 11306005: Download large icon if available when creating secondary tiles on Windows 8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/metro_pin_tab_helper_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
9
10 #include "chrome/common/favicon_url.h"
8 #include "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
9 #include "content/public/browser/web_contents_user_data.h" 12 #include "content/public/browser/web_contents_user_data.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
11 15
12 // Per-tab class to help manage metro pinning. 16 // Per-tab class to help manage metro pinning.
13 class MetroPinTabHelper 17 class MetroPinTabHelper
14 : public content::WebContentsObserver, 18 : public content::WebContentsObserver,
15 public content::WebContentsUserData<MetroPinTabHelper> { 19 public content::WebContentsUserData<MetroPinTabHelper> {
16 public: 20 public:
17 virtual ~MetroPinTabHelper(); 21 virtual ~MetroPinTabHelper();
18 22
19 bool is_pinned() const { return is_pinned_; } 23 bool is_pinned() const { return is_pinned_; }
20 24
21 void TogglePinnedToStartScreen(); 25 void TogglePinnedToStartScreen();
22 26
23 // content::WebContentsObserver overrides: 27 // content::WebContentsObserver overrides:
24 virtual void DidNavigateMainFrame( 28 virtual void DidNavigateMainFrame(
25 const content::LoadCommittedDetails& details, 29 const content::LoadCommittedDetails& details,
26 const content::FrameNavigateParams& params) OVERRIDE; 30 const content::FrameNavigateParams& params) OVERRIDE;
27 31
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
33
28 private: 34 private:
29 // The TaskRunner handles running tasks for this helper on the FILE thread. 35 // The FaviconDownloader class handles downloading the favicons when a page
30 class TaskRunner; 36 // is being pinned. After it has downloaded any available favicons it will
37 // continue on with the page pinning action.
38 class FaviconDownloader;
31 39
32 explicit MetroPinTabHelper(content::WebContents* tab_contents); 40 explicit MetroPinTabHelper(content::WebContents* tab_contents);
33 friend class content::WebContentsUserData<MetroPinTabHelper>; 41 friend class content::WebContentsUserData<MetroPinTabHelper>;
34 42
43 // Message Handlers.
44 void OnUpdateFaviconURL(int32 page_id,
45 const std::vector<FaviconURL>& candidates);
46 void OnDidDownloadFavicon(int id,
47 const GURL& image_url,
48 bool errored,
49 int requested_size,
50 const std::vector<SkBitmap>& bitmaps);
51
35 // Queries the metro driver about the pinned state of the current URL. 52 // Queries the metro driver about the pinned state of the current URL.
36 void UpdatePinnedStateForCurrentURL(); 53 void UpdatePinnedStateForCurrentURL();
37 54
38 void UnPinPageFromStartScreen(); 55 void UnPinPageFromStartScreen();
39 56
57 // Called by the |favicon_downloader_| when it has finished.
58 void FaviconDownloaderFinished();
59
40 // Whether the current URL is pinned to the metro start screen. 60 // Whether the current URL is pinned to the metro start screen.
41 bool is_pinned_; 61 bool is_pinned_;
42 62
43 // The task runner for the helper, which runs things for it on the FILE 63 // Candidate Favicon URLs for the current page.
44 // thread. 64 std::vector<FaviconURL> favicon_url_candidates_;
45 scoped_refptr<TaskRunner> task_runner_; 65
66 // The currently active FaviconDownloader, if there is one.
67 scoped_ptr<FaviconDownloader> favicon_downloader_;
46 68
47 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper); 69 DISALLOW_COPY_AND_ASSIGN(MetroPinTabHelper);
48 }; 70 };
49 71
50 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_ 72 #endif // CHROME_BROWSER_UI_METRO_PIN_TAB_HELPER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/metro_pin_tab_helper_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698