OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BUNDLE_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // STATE_INSTALLED - installed bubble successful installs list | 109 // STATE_INSTALLED - installed bubble successful installs list |
110 // STATE_FAILED - installed bubble failed installs list | 110 // STATE_FAILED - installed bubble failed installs list |
111 base::string16 GetHeadingTextFor(Item::State state) const; | 111 base::string16 GetHeadingTextFor(Item::State state) const; |
112 | 112 |
113 private: | 113 private: |
114 friend class base::RefCountedThreadSafe<BundleInstaller>; | 114 friend class base::RefCountedThreadSafe<BundleInstaller>; |
115 | 115 |
116 typedef std::map<std::string, Item> ItemMap; | 116 typedef std::map<std::string, Item> ItemMap; |
117 typedef std::map<std::string, linked_ptr<base::DictionaryValue> > ManifestMap; | 117 typedef std::map<std::string, linked_ptr<base::DictionaryValue> > ManifestMap; |
118 | 118 |
119 virtual ~BundleInstaller(); | 119 ~BundleInstaller() override; |
120 | 120 |
121 // Displays the install bubble for |bundle| on |browser|. | 121 // Displays the install bubble for |bundle| on |browser|. |
122 // Note: this is a platform specific implementation. | 122 // Note: this is a platform specific implementation. |
123 static void ShowInstalledBubble(const BundleInstaller* bundle, | 123 static void ShowInstalledBubble(const BundleInstaller* bundle, |
124 Browser* browser); | 124 Browser* browser); |
125 | 125 |
126 // Parses the manifests using WebstoreInstallHelper. | 126 // Parses the manifests using WebstoreInstallHelper. |
127 void ParseManifests(); | 127 void ParseManifests(); |
128 | 128 |
129 // Notifies the delegate that the installation has been approved. | 129 // Notifies the delegate that the installation has been approved. |
130 void ReportApproved(); | 130 void ReportApproved(); |
131 | 131 |
132 // Notifies the delegate that the installation was canceled. | 132 // Notifies the delegate that the installation was canceled. |
133 void ReportCanceled(bool user_initiated); | 133 void ReportCanceled(bool user_initiated); |
134 | 134 |
135 // Notifies the delegate that the installation is complete. | 135 // Notifies the delegate that the installation is complete. |
136 void ReportComplete(); | 136 void ReportComplete(); |
137 | 137 |
138 // Prompts the user to install the bundle once we have dummy extensions for | 138 // Prompts the user to install the bundle once we have dummy extensions for |
139 // all the pending items. | 139 // all the pending items. |
140 void ShowPromptIfDoneParsing(); | 140 void ShowPromptIfDoneParsing(); |
141 | 141 |
142 // Prompts the user to install the bundle. | 142 // Prompts the user to install the bundle. |
143 void ShowPrompt(); | 143 void ShowPrompt(); |
144 | 144 |
145 // Displays the installed bubble once all items have installed or failed. | 145 // Displays the installed bubble once all items have installed or failed. |
146 void ShowInstalledBubbleIfDone(); | 146 void ShowInstalledBubbleIfDone(); |
147 | 147 |
148 // WebstoreInstallHelper::Delegate implementation: | 148 // WebstoreInstallHelper::Delegate implementation: |
149 virtual void OnWebstoreParseSuccess( | 149 void OnWebstoreParseSuccess(const std::string& id, |
150 const std::string& id, | 150 const SkBitmap& icon, |
151 const SkBitmap& icon, | 151 base::DictionaryValue* parsed_manifest) override; |
152 base::DictionaryValue* parsed_manifest) override; | 152 void OnWebstoreParseFailure(const std::string& id, |
153 virtual void OnWebstoreParseFailure( | 153 InstallHelperResultCode result_code, |
154 const std::string& id, | 154 const std::string& error_message) override; |
155 InstallHelperResultCode result_code, | |
156 const std::string& error_message) override; | |
157 | 155 |
158 // ExtensionInstallPrompt::Delegate implementation: | 156 // ExtensionInstallPrompt::Delegate implementation: |
159 virtual void InstallUIProceed() override; | 157 void InstallUIProceed() override; |
160 virtual void InstallUIAbort(bool user_initiated) override; | 158 void InstallUIAbort(bool user_initiated) override; |
161 | 159 |
162 // WebstoreInstaller::Delegate implementation: | 160 // WebstoreInstaller::Delegate implementation: |
163 virtual void OnExtensionInstallSuccess(const std::string& id) override; | 161 void OnExtensionInstallSuccess(const std::string& id) override; |
164 virtual void OnExtensionInstallFailure( | 162 void OnExtensionInstallFailure( |
165 const std::string& id, | 163 const std::string& id, |
166 const std::string& error, | 164 const std::string& error, |
167 WebstoreInstaller::FailureReason reason) override; | 165 WebstoreInstaller::FailureReason reason) override; |
168 | 166 |
169 // chrome::BrowserListObserver implementation: | 167 // chrome::BrowserListObserver implementation: |
170 virtual void OnBrowserAdded(Browser* browser) override; | 168 void OnBrowserAdded(Browser* browser) override; |
171 virtual void OnBrowserRemoved(Browser* browser) override; | 169 void OnBrowserRemoved(Browser* browser) override; |
172 virtual void OnBrowserSetLastActive(Browser* browser) override; | 170 void OnBrowserSetLastActive(Browser* browser) override; |
173 | 171 |
174 // Holds the Extensions used to generate the permission warnings. | 172 // Holds the Extensions used to generate the permission warnings. |
175 ExtensionList dummy_extensions_; | 173 ExtensionList dummy_extensions_; |
176 | 174 |
177 // Holds the parsed manifests, indexed by the extension ids. | 175 // Holds the parsed manifests, indexed by the extension ids. |
178 ManifestMap parsed_manifests_; | 176 ManifestMap parsed_manifests_; |
179 | 177 |
180 // True if the user has approved the bundle. | 178 // True if the user has approved the bundle. |
181 bool approved_; | 179 bool approved_; |
182 | 180 |
(...skipping 13 matching lines...) Expand all Loading... |
196 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 194 scoped_ptr<ExtensionInstallPrompt> install_ui_; |
197 | 195 |
198 Delegate* delegate_; | 196 Delegate* delegate_; |
199 | 197 |
200 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); | 198 DISALLOW_COPY_AND_ASSIGN(BundleInstaller); |
201 }; | 199 }; |
202 | 200 |
203 } // namespace extensions | 201 } // namespace extensions |
204 | 202 |
205 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ | 203 #endif // CHROME_BROWSER_EXTENSIONS_BUNDLE_INSTALLER_H_ |
OLD | NEW |