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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 std::map<int, BookmarkAppHelper::BitmapAndSource> bitmap_map, | 102 std::map<int, BookmarkAppHelper::BitmapAndSource> bitmap_map, |
103 WebApplicationInfo* web_app_info); | 103 WebApplicationInfo* web_app_info); |
104 | 104 |
105 // Begins the asynchronous bookmark app creation. | 105 // Begins the asynchronous bookmark app creation. |
106 void Create(const CreateBookmarkAppCallback& callback); | 106 void Create(const CreateBookmarkAppCallback& callback); |
107 | 107 |
108 // Begins the asynchronous bookmark app creation from an app banner. | 108 // Begins the asynchronous bookmark app creation from an app banner. |
109 void CreateFromAppBanner(const CreateBookmarkAppCallback& callback, | 109 void CreateFromAppBanner(const CreateBookmarkAppCallback& callback, |
110 const content::Manifest& manifest); | 110 const content::Manifest& manifest); |
111 | 111 |
112 private: | 112 protected: |
113 friend class TestBookmarkAppHelper; | 113 // Protected methods for testing. |
114 | 114 |
115 // Called by the WebContents when the manifest has been downloaded. If there | 115 // 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 | 116 // is no manifest, or the WebContents is destroyed before the manifest could |
117 // be downloaded, this is called with an empty manifest. | 117 // be downloaded, this is called with an empty manifest. |
118 void OnDidGetManifest(const GURL& manifest_url, | 118 void OnDidGetManifest(const GURL& manifest_url, |
119 const content::Manifest& manifest); | 119 const content::Manifest& manifest); |
120 | 120 |
121 // Performs post icon download tasks including installing the bookmark app. | 121 // Performs post icon download tasks including installing the bookmark app. |
122 void OnIconsDownloaded(bool success, | 122 virtual void OnIconsDownloaded( |
123 const std::map<GURL, std::vector<SkBitmap> >& bitmaps); | 123 bool success, |
| 124 const std::map<GURL, std::vector<SkBitmap>>& bitmaps); |
124 | 125 |
| 126 private: |
125 // Called after the bubble has been shown, and the user has either accepted or | 127 // Called after the bubble has been shown, and the user has either accepted or |
126 // the dialog was dismissed. | 128 // the dialog was dismissed. |
127 void OnBubbleCompleted(bool user_accepted, | 129 void OnBubbleCompleted(bool user_accepted, |
128 const WebApplicationInfo& web_app_info); | 130 const WebApplicationInfo& web_app_info); |
129 | 131 |
130 // Called when the installation of the app is complete to perform the final | 132 // Called when the installation of the app is complete to perform the final |
131 // installation steps. | 133 // installation steps. |
132 void FinishInstallation(const Extension* extension); | 134 void FinishInstallation(const Extension* extension); |
133 | 135 |
134 // Overridden from content::NotificationObserver: | 136 // Overridden from content::NotificationObserver: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 content::BrowserContext* browser_context, | 178 content::BrowserContext* browser_context, |
177 const extensions::Extension* extension, | 179 const extensions::Extension* extension, |
178 const base::Callback<void(const WebApplicationInfo&)> callback); | 180 const base::Callback<void(const WebApplicationInfo&)> callback); |
179 | 181 |
180 // Returns whether the given |url| is a valid bookmark app url. | 182 // Returns whether the given |url| is a valid bookmark app url. |
181 bool IsValidBookmarkAppUrl(const GURL& url); | 183 bool IsValidBookmarkAppUrl(const GURL& url); |
182 | 184 |
183 } // namespace extensions | 185 } // namespace extensions |
184 | 186 |
185 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 187 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
OLD | NEW |