OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 class BrowserContext; | 27 class BrowserContext; |
28 class WebContents; | 28 class WebContents; |
29 } | 29 } |
30 | 30 |
31 namespace extensions { | 31 namespace extensions { |
32 class CrxInstaller; | 32 class CrxInstaller; |
33 class Extension; | 33 class Extension; |
34 | 34 |
| 35 namespace test { |
| 36 class TestBookmarkAppHelper; |
| 37 } |
| 38 |
35 // A helper class for creating bookmark apps from a WebContents. | 39 // A helper class for creating bookmark apps from a WebContents. |
36 class BookmarkAppHelper : public content::NotificationObserver { | 40 class BookmarkAppHelper : public content::NotificationObserver { |
37 public: | 41 public: |
38 struct BitmapAndSource { | 42 struct BitmapAndSource { |
39 BitmapAndSource(); | 43 BitmapAndSource(); |
40 BitmapAndSource(const GURL& source_url_p, const SkBitmap& bitmap_p); | 44 BitmapAndSource(const GURL& source_url_p, const SkBitmap& bitmap_p); |
41 ~BitmapAndSource(); | 45 ~BitmapAndSource(); |
42 | 46 |
43 GURL source_url; | 47 GURL source_url; |
44 SkBitmap bitmap; | 48 SkBitmap bitmap; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 WebApplicationInfo* web_app_info); | 107 WebApplicationInfo* web_app_info); |
104 | 108 |
105 // Begins the asynchronous bookmark app creation. | 109 // Begins the asynchronous bookmark app creation. |
106 void Create(const CreateBookmarkAppCallback& callback); | 110 void Create(const CreateBookmarkAppCallback& callback); |
107 | 111 |
108 // Begins the asynchronous bookmark app creation from an app banner. | 112 // Begins the asynchronous bookmark app creation from an app banner. |
109 void CreateFromAppBanner(const CreateBookmarkAppCallback& callback, | 113 void CreateFromAppBanner(const CreateBookmarkAppCallback& callback, |
110 const content::Manifest& manifest); | 114 const content::Manifest& manifest); |
111 | 115 |
112 private: | 116 private: |
113 friend class TestBookmarkAppHelper; | 117 friend class test::TestBookmarkAppHelper; |
114 | 118 |
115 // Called by the WebContents when the manifest has been downloaded. If there | 119 // Called by the WebContents when the manifest has been downloaded. If there |
116 // is no manifest, or the WebContents is destroyed before the manifest could | 120 // is no manifest, or the WebContents is destroyed before the manifest could |
117 // be downloaded, this is called with an empty manifest. | 121 // be downloaded, this is called with an empty manifest. |
118 void OnDidGetManifest(const GURL& manifest_url, | 122 void OnDidGetManifest(const GURL& manifest_url, |
119 const content::Manifest& manifest); | 123 const content::Manifest& manifest); |
120 | 124 |
121 // Performs post icon download tasks including installing the bookmark app. | 125 // Performs post icon download tasks including installing the bookmark app. |
122 void OnIconsDownloaded(bool success, | 126 virtual void OnIconsDownloaded( |
123 const std::map<GURL, std::vector<SkBitmap> >& bitmaps); | 127 bool success, |
| 128 const std::map<GURL, std::vector<SkBitmap>>& bitmaps); |
124 | 129 |
125 // Called after the bubble has been shown, and the user has either accepted or | 130 // Called after the bubble has been shown, and the user has either accepted or |
126 // the dialog was dismissed. | 131 // the dialog was dismissed. |
127 void OnBubbleCompleted(bool user_accepted, | 132 void OnBubbleCompleted(bool user_accepted, |
128 const WebApplicationInfo& web_app_info); | 133 const WebApplicationInfo& web_app_info); |
129 | 134 |
130 // Called when the installation of the app is complete to perform the final | 135 // Called when the installation of the app is complete to perform the final |
131 // installation steps. | 136 // installation steps. |
132 void FinishInstallation(const Extension* extension); | 137 void FinishInstallation(const Extension* extension); |
133 | 138 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 content::BrowserContext* browser_context, | 181 content::BrowserContext* browser_context, |
177 const extensions::Extension* extension, | 182 const extensions::Extension* extension, |
178 const base::Callback<void(const WebApplicationInfo&)> callback); | 183 const base::Callback<void(const WebApplicationInfo&)> callback); |
179 | 184 |
180 // Returns whether the given |url| is a valid bookmark app url. | 185 // Returns whether the given |url| is a valid bookmark app url. |
181 bool IsValidBookmarkAppUrl(const GURL& url); | 186 bool IsValidBookmarkAppUrl(const GURL& url); |
182 | 187 |
183 } // namespace extensions | 188 } // namespace extensions |
184 | 189 |
185 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 190 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
OLD | NEW |