| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_UI_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 11 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 virtual std::string GetMimeType(const std::string&) const { | 49 virtual std::string GetMimeType(const std::string&) const { |
| 50 return "text/html"; | 50 return "text/html"; |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 ~ExtensionsUIHTMLSource() {} | 54 ~ExtensionsUIHTMLSource() {} |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(ExtensionsUIHTMLSource); | 56 DISALLOW_COPY_AND_ASSIGN(ExtensionsUIHTMLSource); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // The handler for Javascript messages related to the "extensions" view. | 59 // The handler for JavaScript messages related to the "extensions" view. |
| 60 class ExtensionsDOMHandler | 60 class ExtensionsDOMHandler |
| 61 : public DOMMessageHandler, | 61 : public DOMMessageHandler, |
| 62 public NotificationObserver, | 62 public NotificationObserver, |
| 63 public PackExtensionJob::Client, | 63 public PackExtensionJob::Client, |
| 64 public SelectFileDialog::Listener, | 64 public SelectFileDialog::Listener, |
| 65 public ExtensionInstallUI::Delegate { | 65 public ExtensionInstallUI::Delegate { |
| 66 public: | 66 public: |
| 67 | 67 |
| 68 // Helper class that loads the icons for the extensions in the management UI. | 68 // Helper class that loads the icons for the extensions in the management UI. |
| 69 // We do this with native code instead of just using chrome-extension:// URLs | 69 // We do this with native code instead of just using chrome-extension:// URLs |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Loads the extension resources into the json data, then calls OnIconsLoaded. | 194 // Loads the extension resources into the json data, then calls OnIconsLoaded. |
| 195 // Takes ownership of |icons|. | 195 // Takes ownership of |icons|. |
| 196 // Called on the file thread. | 196 // Called on the file thread. |
| 197 void LoadExtensionIcons(std::vector<ExtensionResource>* icons, | 197 void LoadExtensionIcons(std::vector<ExtensionResource>* icons, |
| 198 DictionaryValue* json_data); | 198 DictionaryValue* json_data); |
| 199 | 199 |
| 200 // Takes ownership of |json_data| and tells HTML about it. | 200 // Takes ownership of |json_data| and tells HTML about it. |
| 201 // Called on the UI thread. | 201 // Called on the UI thread. |
| 202 void OnIconsLoaded(DictionaryValue* json_data); | 202 void OnIconsLoaded(DictionaryValue* json_data); |
| 203 | 203 |
| 204 // Returns the ExtensionInstallUI object for this class, creating it if |
| 205 // needed. |
| 206 ExtensionInstallUI* GetExtensionInstallUI(); |
| 207 |
| 204 // Our model. | 208 // Our model. |
| 205 scoped_refptr<ExtensionsService> extensions_service_; | 209 scoped_refptr<ExtensionsService> extensions_service_; |
| 206 | 210 |
| 207 // Used to pick the directory when loading an extension. | 211 // Used to pick the directory when loading an extension. |
| 208 scoped_refptr<SelectFileDialog> load_extension_dialog_; | 212 scoped_refptr<SelectFileDialog> load_extension_dialog_; |
| 209 | 213 |
| 210 // Used to package the extension. | 214 // Used to package the extension. |
| 211 scoped_refptr<PackExtensionJob> pack_job_; | 215 scoped_refptr<PackExtensionJob> pack_job_; |
| 212 | 216 |
| 213 // Used to load icons asynchronously on the file thread. | 217 // Used to load icons asynchronously on the file thread. |
| 214 scoped_refptr<IconLoader> icon_loader_; | 218 scoped_refptr<IconLoader> icon_loader_; |
| 215 | 219 |
| 220 // Used to show confirmation UI for uninstalling/enabling extensions in |
| 221 // incognito mode. |
| 222 scoped_ptr<ExtensionInstallUI> install_ui_; |
| 223 |
| 216 // We monitor changes to the extension system so that we can reload when | 224 // We monitor changes to the extension system so that we can reload when |
| 217 // necessary. | 225 // necessary. |
| 218 NotificationRegistrar registrar_; | 226 NotificationRegistrar registrar_; |
| 219 | 227 |
| 220 // The id of the extension we are prompting the user about. | 228 // The id of the extension we are prompting the user about. |
| 221 std::string extension_id_prompting_; | 229 std::string extension_id_prompting_; |
| 222 | 230 |
| 223 // The type of prompt that is open. Only ever uninstall or enable-incognito. | 231 // The type of prompt that is open. Only ever uninstall or enable-incognito. |
| 224 // Invalid if no prompt is open. | 232 // Invalid if no prompt is open. |
| 225 ExtensionInstallUI::PromptType ui_prompt_type_; | 233 ExtensionInstallUI::PromptType ui_prompt_type_; |
| 226 | 234 |
| 227 DISALLOW_COPY_AND_ASSIGN(ExtensionsDOMHandler); | 235 DISALLOW_COPY_AND_ASSIGN(ExtensionsDOMHandler); |
| 228 }; | 236 }; |
| 229 | 237 |
| 230 class ExtensionsUI : public DOMUI { | 238 class ExtensionsUI : public DOMUI { |
| 231 public: | 239 public: |
| 232 explicit ExtensionsUI(TabContents* contents); | 240 explicit ExtensionsUI(TabContents* contents); |
| 233 | 241 |
| 234 static RefCountedMemory* GetFaviconResourceBytes(); | 242 static RefCountedMemory* GetFaviconResourceBytes(); |
| 235 | 243 |
| 236 static void RegisterUserPrefs(PrefService* prefs); | 244 static void RegisterUserPrefs(PrefService* prefs); |
| 237 | 245 |
| 238 private: | 246 private: |
| 239 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); | 247 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); |
| 240 }; | 248 }; |
| 241 | 249 |
| 242 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ | 250 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ |
| OLD | NEW |