OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_WEBSTORE_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 | 17 |
| 18 class FilePath; |
18 class NavigationController; | 19 class NavigationController; |
19 class Profile; | 20 class Profile; |
20 | 21 |
21 // Downloads and installs extensions from the web store. | 22 // Downloads and installs extensions from the web store. |
22 class WebstoreInstaller : public content::NotificationObserver, | 23 class WebstoreInstaller : public content::NotificationObserver, |
23 public base::RefCounted<WebstoreInstaller> { | 24 public base::RefCounted<WebstoreInstaller> { |
24 public: | 25 public: |
25 enum Flag { | 26 enum Flag { |
26 FLAG_NONE = 0, | 27 FLAG_NONE = 0, |
27 | 28 |
(...skipping 25 matching lines...) Expand all Loading... |
53 | 54 |
54 // Starts downloading and installing the extension. | 55 // Starts downloading and installing the extension. |
55 void Start(); | 56 void Start(); |
56 | 57 |
57 // content::NotificationObserver | 58 // content::NotificationObserver |
58 virtual void Observe(int type, | 59 virtual void Observe(int type, |
59 const content::NotificationSource& source, | 60 const content::NotificationSource& source, |
60 const content::NotificationDetails& details) OVERRIDE; | 61 const content::NotificationDetails& details) OVERRIDE; |
61 | 62 |
62 private: | 63 private: |
| 64 // Starts downloading the extension to |file_path|. |
| 65 void StartDownload(FilePath file_path); |
| 66 |
63 // Reports an install |error| to the delegate for the given extension if this | 67 // Reports an install |error| to the delegate for the given extension if this |
64 // managed its installation. This also removes the associated PendingInstall. | 68 // managed its installation. This also removes the associated PendingInstall. |
65 void ReportFailure(const std::string& error); | 69 void ReportFailure(const std::string& error); |
66 | 70 |
67 // Reports a successful install to the delegate for the given extension if | 71 // Reports a successful install to the delegate for the given extension if |
68 // this managed its installation. This also removes the associated | 72 // this managed its installation. This also removes the associated |
69 // PendingInstall. | 73 // PendingInstall. |
70 void ReportSuccess(); | 74 void ReportSuccess(); |
71 | 75 |
72 content::NotificationRegistrar registrar_; | 76 content::NotificationRegistrar registrar_; |
73 Profile* profile_; | 77 Profile* profile_; |
74 Delegate* delegate_; | 78 Delegate* delegate_; |
75 NavigationController* controller_; | 79 NavigationController* controller_; |
76 std::string id_; | 80 std::string id_; |
77 int flags_; | 81 int flags_; |
78 GURL download_url_; | 82 GURL download_url_; |
79 }; | 83 }; |
80 | 84 |
81 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ | 85 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_INSTALLER_H_ |
OLD | NEW |