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_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" |
16 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/window/dialog_delegate.h" | 16 #include "ui/views/window/dialog_delegate.h" |
18 | 17 |
19 class FaviconDownloadHelper; | 18 class FaviconDownloadHelper; |
| 19 class GURL; |
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 } |
26 | 26 |
27 namespace extensions { | 27 namespace extensions { |
28 class Extension; | 28 class Extension; |
29 } | 29 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : public CreateApplicationShortcutView { |
89 public FaviconDownloadHelperDelegate { | |
90 public: | 89 public: |
91 explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents); | 90 explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents); |
92 virtual ~CreateUrlApplicationShortcutView(); | 91 virtual ~CreateUrlApplicationShortcutView(); |
93 | 92 |
94 virtual bool Accept() OVERRIDE; | 93 virtual bool Accept() OVERRIDE; |
95 | 94 |
96 private: | 95 private: |
97 // Fetch the largest unprocessed icon. | 96 // Fetch the largest unprocessed icon. |
98 // The first largest icon downloaded and decoded successfully will be used. | 97 // The first largest icon downloaded and decoded successfully will be used. |
99 void FetchIcon(); | 98 void FetchIcon(); |
100 | 99 |
101 // FaviconDownloadHelperDelegate overrides. | 100 // Favicon download callback. |
102 virtual void OnDidDownloadFavicon( | 101 void DidDownloadFavicon( |
103 int id, | 102 int id, |
104 const GURL& image_url, | 103 const GURL& image_url, |
105 bool errored, | 104 bool errored, |
106 int requested_size, | 105 int requested_size, |
107 const std::vector<SkBitmap>& bitmaps) OVERRIDE; | 106 const std::vector<SkBitmap>& bitmaps); |
108 | 107 |
109 // The tab whose URL is being turned into an app. | 108 // The tab whose URL is being turned into an app. |
110 content::WebContents* web_contents_; | 109 content::WebContents* web_contents_; |
111 | 110 |
112 // Helper class to manage the downloading of favicons. | |
113 scoped_ptr<FaviconDownloadHelper> download_helper_; | |
114 | |
115 // Pending app icon download tracked by us. | 111 // Pending app icon download tracked by us. |
116 int pending_download_id_; | 112 int pending_download_id_; |
117 | 113 |
118 // Unprocessed icons from the WebApplicationInfo passed in. | 114 // Unprocessed icons from the WebApplicationInfo passed in. |
119 web_app::IconInfoList unprocessed_icons_; | 115 web_app::IconInfoList unprocessed_icons_; |
120 | 116 |
121 DISALLOW_COPY_AND_ASSIGN(CreateUrlApplicationShortcutView); | 117 DISALLOW_COPY_AND_ASSIGN(CreateUrlApplicationShortcutView); |
122 }; | 118 }; |
123 | 119 |
124 // Create an application shortcut pointing to a chrome application. | 120 // Create an application shortcut pointing to a chrome application. |
(...skipping 13 matching lines...) Expand all Loading... |
138 int index) OVERRIDE; | 134 int index) OVERRIDE; |
139 | 135 |
140 private: | 136 private: |
141 const extensions::Extension* app_; | 137 const extensions::Extension* app_; |
142 ImageLoadingTracker tracker_; | 138 ImageLoadingTracker tracker_; |
143 | 139 |
144 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); | 140 DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); |
145 }; | 141 }; |
146 | 142 |
147 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ | 143 #endif // CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_ |
OLD | NEW |