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

Side by Side Diff: chrome/browser/ui/views/create_application_shortcut_view.h

Issue 11411180: move favicon download code from chrome/ into content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/extensions/image_loading_tracker.h" 13 #include "chrome/browser/extensions/image_loading_tracker.h"
14 #include "chrome/browser/favicon/favicon_download_helper_delegate.h"
15 #include "chrome/browser/web_applications/web_app.h" 14 #include "chrome/browser/web_applications/web_app.h"
15 #include "content/public/browser/favicon_download_delegate.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/window/dialog_delegate.h" 17 #include "ui/views/window/dialog_delegate.h"
18 18
19 class FaviconDownloadHelper; 19 class FaviconDownloadHelper;
20 class Profile; 20 class Profile;
21 class SkBitmap; 21 class SkBitmap;
22 22
23 namespace content { 23 namespace content {
24 class WebContents; 24 class WebContents;
25 } 25 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 views::Checkbox* menu_check_box_; 78 views::Checkbox* menu_check_box_;
79 views::Checkbox* quick_launch_check_box_; 79 views::Checkbox* quick_launch_check_box_;
80 80
81 // Target shortcut info. 81 // Target shortcut info.
82 ShellIntegration::ShortcutInfo shortcut_info_; 82 ShellIntegration::ShortcutInfo shortcut_info_;
83 83
84 DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView); 84 DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView);
85 }; 85 };
86 86
87 // Create an application shortcut pointing to a URL. 87 // Create an application shortcut pointing to a URL.
88 class CreateUrlApplicationShortcutView : public CreateApplicationShortcutView, 88 class CreateUrlApplicationShortcutView
89 public FaviconDownloadHelperDelegate { 89 : public CreateApplicationShortcutView,
90 public content::FaviconDownloadDelegate {
90 public: 91 public:
91 explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents); 92 explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents);
92 virtual ~CreateUrlApplicationShortcutView(); 93 virtual ~CreateUrlApplicationShortcutView();
93 94
94 virtual bool Accept() OVERRIDE; 95 virtual bool Accept() OVERRIDE;
95 96
96 private: 97 private:
97 // Fetch the largest unprocessed icon. 98 // Fetch the largest unprocessed icon.
98 // The first largest icon downloaded and decoded successfully will be used. 99 // The first largest icon downloaded and decoded successfully will be used.
99 void FetchIcon(); 100 void FetchIcon();
100 101
101 // FaviconDownloadHelperDelegate overrides. 102 // content::FaviconDownloadDelegate overrides.
102 virtual void OnDidDownloadFavicon( 103 virtual void DidDownloadFavicon(
103 int id, 104 int id,
104 const GURL& image_url, 105 const GURL& image_url,
105 bool errored, 106 bool errored,
106 int requested_size, 107 int requested_size,
107 const std::vector<SkBitmap>& bitmaps) OVERRIDE; 108 const std::vector<SkBitmap>& bitmaps) OVERRIDE;
108 109
109 // The tab whose URL is being turned into an app. 110 // The tab whose URL is being turned into an app.
110 content::WebContents* web_contents_; 111 content::WebContents* web_contents_;
111 112
112 // Helper class to manage the downloading of favicons.
113 scoped_ptr<FaviconDownloadHelper> download_helper_;
114
115 // Pending app icon download tracked by us. 113 // Pending app icon download tracked by us.
116 int pending_download_id_; 114 int pending_download_id_;
117 115
118 // Unprocessed icons from the WebApplicationInfo passed in. 116 // Unprocessed icons from the WebApplicationInfo passed in.
119 web_app::IconInfoList unprocessed_icons_; 117 web_app::IconInfoList unprocessed_icons_;
120 118
121 DISALLOW_COPY_AND_ASSIGN(CreateUrlApplicationShortcutView); 119 DISALLOW_COPY_AND_ASSIGN(CreateUrlApplicationShortcutView);
122 }; 120 };
123 121
124 // Create an application shortcut pointing to a chrome application. 122 // Create an application shortcut pointing to a chrome application.
(...skipping 13 matching lines...) Expand all
138 int index) OVERRIDE; 136 int index) OVERRIDE;
139 137
140 private: 138 private:
141 const extensions::Extension* app_; 139 const extensions::Extension* app_;
142 ImageLoadingTracker tracker_; 140 ImageLoadingTracker tracker_;
143 141
144 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); 142 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView);
145 }; 143 };
146 144
147 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ 145 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698