Chromium Code Reviews| 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_UI_APP_LIST_DRIVE_DRIVE_APP_CONVERTER_H_ | 5 #ifndef CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_CONVERTER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_DRIVE_DRIVE_APP_CONVERTER_H_ | 6 #define CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_CONVERTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "chrome/browser/drive/drive_app_registry.h" | 14 #include "chrome/browser/drive/drive_app_registry.h" |
| 15 #include "chrome/browser/extensions/install_observer.h" | 15 #include "chrome/browser/extensions/install_observer.h" |
| 16 #include "chrome/common/web_application_info.h" | 16 #include "chrome/common/web_application_info.h" |
| 17 | 17 |
| 18 class Profile; | |
| 19 | |
| 18 namespace extensions { | 20 namespace extensions { |
|
benwells
2014/06/05 01:24:39
This and the other files in c/b/apps shouldn't be
xiyuan
2014/06/05 17:48:32
Done.
| |
| 21 | |
| 19 class CrxInstaller; | 22 class CrxInstaller; |
| 20 class Extension; | 23 class Extension; |
| 21 } | |
| 22 | |
| 23 class Profile; | |
| 24 | 24 |
| 25 // DriveAppConverter creates and installs a local URL app for the given | 25 // DriveAppConverter creates and installs a local URL app for the given |
| 26 // DriveAppInfo into the given profile. | 26 // DriveAppInfo into the given profile. |
| 27 class DriveAppConverter : public extensions::InstallObserver { | 27 class DriveAppConverter : public InstallObserver { |
| 28 public: | 28 public: |
| 29 typedef base::Callback<void(const DriveAppConverter*, bool success)> | 29 typedef base::Callback<void(const DriveAppConverter*, bool success)> |
| 30 FinishedCallback; | 30 FinishedCallback; |
| 31 | 31 |
| 32 DriveAppConverter(Profile* profile, | 32 DriveAppConverter(Profile* profile, |
| 33 const drive::DriveAppInfo& app_info, | 33 const drive::DriveAppInfo& app_info, |
| 34 const FinishedCallback& finished_callback); | 34 const FinishedCallback& finished_callback); |
| 35 virtual ~DriveAppConverter(); | 35 virtual ~DriveAppConverter(); |
| 36 | 36 |
| 37 void Start(); | 37 void Start(); |
| 38 bool IsStarted() const; | |
| 38 | 39 |
| 39 const drive::DriveAppInfo& app_info() const { return app_info_; } | 40 const drive::DriveAppInfo& app_info() const { return app_info_; } |
| 40 const extensions::Extension* app() const { return app_; } | 41 const Extension* app() const { return app_; } |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 class IconFetcher; | 44 class IconFetcher; |
| 44 | 45 |
| 45 // Callbacks from IconFetcher. | 46 // Callbacks from IconFetcher. |
| 46 void OnIconFetchComplete(const IconFetcher* fetcher); | 47 void OnIconFetchComplete(const IconFetcher* fetcher); |
| 47 | 48 |
| 48 void StartInstall(); | 49 void StartInstall(); |
| 49 void PostInstallCleanUp(); | 50 void PostInstallCleanUp(); |
| 50 | 51 |
| 51 // extensions::InstallObserver: | 52 // InstallObserver: |
| 52 virtual void OnFinishCrxInstall(const std::string& extension_id, | 53 virtual void OnFinishCrxInstall(const std::string& extension_id, |
| 53 bool success) OVERRIDE; | 54 bool success) OVERRIDE; |
| 54 | 55 |
| 55 Profile* profile_; | 56 Profile* profile_; |
| 56 const drive::DriveAppInfo app_info_; | 57 const drive::DriveAppInfo app_info_; |
| 57 | 58 |
| 58 WebApplicationInfo web_app_; | 59 WebApplicationInfo web_app_; |
| 59 const extensions::Extension* app_; | 60 const Extension* app_; |
| 60 | 61 |
| 61 ScopedVector<IconFetcher> fetchers_; | 62 ScopedVector<IconFetcher> fetchers_; |
| 62 scoped_refptr<extensions::CrxInstaller> crx_installer_; | 63 scoped_refptr<CrxInstaller> crx_installer_; |
| 63 | 64 |
| 64 FinishedCallback finished_callback_; | 65 FinishedCallback finished_callback_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(DriveAppConverter); | 67 DISALLOW_COPY_AND_ASSIGN(DriveAppConverter); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 #endif // CHROME_BROWSER_UI_APP_LIST_DRIVE_DRIVE_APP_CONVERTER_H_ | 70 } // namespace extensions |
| 71 | |
| 72 #endif // CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_CONVERTER_H_ | |
| OLD | NEW |