| 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 <set> | 10 #include <set> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "chrome/common/web_application_info.h" | 16 #include "chrome/common/web_application_info.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/common/manifest.h" | 19 #include "content/public/common/manifest.h" |
| 20 | 20 |
| 21 class ExtensionService; | 21 class ExtensionService; |
| 22 class FaviconDownloader; | 22 class FaviconDownloader; |
| 23 class Profile; | 23 class Profile; |
| 24 class SkBitmap; | 24 class SkBitmap; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 content::WebContents* contents_; | 142 content::WebContents* contents_; |
| 143 | 143 |
| 144 // The WebApplicationInfo that the bookmark app is being created for. | 144 // The WebApplicationInfo that the bookmark app is being created for. |
| 145 WebApplicationInfo web_app_info_; | 145 WebApplicationInfo web_app_info_; |
| 146 | 146 |
| 147 // Called on app creation or failure. | 147 // Called on app creation or failure. |
| 148 CreateBookmarkAppCallback callback_; | 148 CreateBookmarkAppCallback callback_; |
| 149 | 149 |
| 150 // Downloads icons from the given WebApplicationInfo using the given | 150 // Downloads icons from the given WebApplicationInfo using the given |
| 151 // WebContents. | 151 // WebContents. |
| 152 scoped_ptr<FaviconDownloader> favicon_downloader_; | 152 std::unique_ptr<FaviconDownloader> favicon_downloader_; |
| 153 | 153 |
| 154 // Used to install the created bookmark app. | 154 // Used to install the created bookmark app. |
| 155 scoped_refptr<extensions::CrxInstaller> crx_installer_; | 155 scoped_refptr<extensions::CrxInstaller> crx_installer_; |
| 156 | 156 |
| 157 content::NotificationRegistrar registrar_; | 157 content::NotificationRegistrar registrar_; |
| 158 | 158 |
| 159 // With fast tab unloading enabled, shutting down can cause BookmarkAppHelper | 159 // With fast tab unloading enabled, shutting down can cause BookmarkAppHelper |
| 160 // to be destroyed before the bookmark creation bubble. Use weak pointers to | 160 // to be destroyed before the bookmark creation bubble. Use weak pointers to |
| 161 // prevent a heap-use-after free in this instance (https://crbug.com/534994). | 161 // prevent a heap-use-after free in this instance (https://crbug.com/534994). |
| 162 base::WeakPtrFactory<BookmarkAppHelper> weak_factory_; | 162 base::WeakPtrFactory<BookmarkAppHelper> weak_factory_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 175 content::BrowserContext* browser_context, | 175 content::BrowserContext* browser_context, |
| 176 const extensions::Extension* extension, | 176 const extensions::Extension* extension, |
| 177 const base::Callback<void(const WebApplicationInfo&)> callback); | 177 const base::Callback<void(const WebApplicationInfo&)> callback); |
| 178 | 178 |
| 179 // Returns whether the given |url| is a valid bookmark app url. | 179 // Returns whether the given |url| is a valid bookmark app url. |
| 180 bool IsValidBookmarkAppUrl(const GURL& url); | 180 bool IsValidBookmarkAppUrl(const GURL& url); |
| 181 | 181 |
| 182 } // namespace extensions | 182 } // namespace extensions |
| 183 | 183 |
| 184 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ | 184 #endif // CHROME_BROWSER_EXTENSIONS_BOOKMARK_APP_HELPER_H_ |
| OLD | NEW |