| 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_UI_APP_LIST_EXTENSION_APP_MODEL_BUILDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_MODEL_BUILDER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_MODEL_BUILDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_MODEL_BUILDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 scoped_ptr<ExtensionAppItem> CreateAppItem( | 91 scoped_ptr<ExtensionAppItem> CreateAppItem( |
| 92 const std::string& extension_id, | 92 const std::string& extension_id, |
| 93 const std::string& extension_name, | 93 const std::string& extension_name, |
| 94 const gfx::ImageSkia& installing_icon, | 94 const gfx::ImageSkia& installing_icon, |
| 95 bool is_platform_app); | 95 bool is_platform_app); |
| 96 | 96 |
| 97 // Populates the model with apps. | 97 // Populates the model with apps. |
| 98 void PopulateApps(); | 98 void PopulateApps(); |
| 99 | 99 |
| 100 // Re-sort apps in case app ordinal prefs are changed. | |
| 101 void ResortApps(); | |
| 102 | |
| 103 // Inserts an app based on app ordinal prefs. | 100 // Inserts an app based on app ordinal prefs. |
| 104 void InsertApp(scoped_ptr<ExtensionAppItem> app); | 101 void InsertApp(scoped_ptr<ExtensionAppItem> app); |
| 105 | 102 |
| 106 // Sets which app is intended to be highlighted. Will remove the highlight | 103 // Sets which app is intended to be highlighted. Will remove the highlight |
| 107 // from a currently highlighted app. | 104 // from a currently highlighted app. |
| 108 void SetHighlightedApp(const std::string& extension_id); | 105 void SetHighlightedApp(const std::string& extension_id); |
| 109 | 106 |
| 110 // Sets the application app with |highlight_app_id_| in |model_| as | 107 // Sets the application app with |highlight_app_id_| in |model_| as |
| 111 // highlighted if |highlighted_app_pending_| is true. If such an app is found, | 108 // highlighted if |highlighted_app_pending_| is true. If such an app is found, |
| 112 // reset |highlighted_app_pending_| so that won't be highlighted again until | 109 // reset |highlighted_app_pending_| so that won't be highlighted again until |
| 113 // another call to SetHighlightedApp() is made. | 110 // another call to SetHighlightedApp() is made. |
| 114 void UpdateHighlight(); | 111 void UpdateHighlight(); |
| 115 | 112 |
| 116 // Returns app instance matching |extension_id| or NULL. | 113 // Returns app instance matching |extension_id| or NULL. |
| 117 ExtensionAppItem* GetExtensionAppItem(const std::string& extension_id); | 114 ExtensionAppItem* GetExtensionAppItem(const std::string& extension_id); |
| 118 | 115 |
| 119 // Initializes the |extension_pref_change_registrar| to listen for extension | 116 // Initializes the |profile_pref_change_registrar_| and the |
| 120 // prefs changes. OnExtensionPreferenceChanged() is called when extension | 117 // |extension_pref_change_registrar_| to listen for changes to profile and |
| 121 // prefs change. | 118 // extension prefs, and call OnProfilePreferenceChanged() or |
| 122 void InitializePrefChangeRegistrar(); | 119 // OnExtensionPreferenceChanged(). |
| 120 void InitializePrefChangeRegistrars(); |
| 121 |
| 122 // Handles profile prefs changes. |
| 123 void OnProfilePreferenceChanged(); |
| 123 | 124 |
| 124 // Handles extension prefs changes. | 125 // Handles extension prefs changes. |
| 125 void OnExtensionPreferenceChanged(); | 126 void OnExtensionPreferenceChanged(); |
| 126 | 127 |
| 127 // Unowned pointers to the service that owns this and associated profile. | 128 // Unowned pointers to the service that owns this and associated profile. |
| 128 app_list::AppListSyncableService* service_; | 129 app_list::AppListSyncableService* service_; |
| 129 Profile* profile_; | 130 Profile* profile_; |
| 130 | 131 |
| 132 // Registrar used to monitor the profile prefs. |
| 133 PrefChangeRegistrar profile_pref_change_registrar_; |
| 134 |
| 131 // Registrar used to monitor the extension prefs. | 135 // Registrar used to monitor the extension prefs. |
| 132 PrefChangeRegistrar extension_pref_change_registrar_; | 136 PrefChangeRegistrar extension_pref_change_registrar_; |
| 133 | 137 |
| 134 // Unowned pointer to the app list controller. | 138 // Unowned pointer to the app list controller. |
| 135 AppListControllerDelegate* controller_; | 139 AppListControllerDelegate* controller_; |
| 136 | 140 |
| 137 // Unowned pointer to the app list model. | 141 // Unowned pointer to the app list model. |
| 138 app_list::AppListModel* model_; | 142 app_list::AppListModel* model_; |
| 139 | 143 |
| 140 std::string highlight_app_id_; | 144 std::string highlight_app_id_; |
| 141 | 145 |
| 142 // True if we haven't set |highlight_app_id_| to be highlighted. This happens | 146 // True if we haven't set |highlight_app_id_| to be highlighted. This happens |
| 143 // if we try to highlight an app that doesn't exist in the list yet. | 147 // if we try to highlight an app that doesn't exist in the list yet. |
| 144 bool highlighted_app_pending_; | 148 bool highlighted_app_pending_; |
| 145 | 149 |
| 146 // We listen to this to show app installing progress. | 150 // We listen to this to show app installing progress. |
| 147 extensions::InstallTracker* tracker_; | 151 extensions::InstallTracker* tracker_; |
| 148 | 152 |
| 149 // Listen extension's load, unload, uninstalled. | 153 // Listen extension's load, unload, uninstalled. |
| 150 extensions::ExtensionRegistry* extension_registry_; | 154 extensions::ExtensionRegistry* extension_registry_; |
| 151 | 155 |
| 152 DISALLOW_COPY_AND_ASSIGN(ExtensionAppModelBuilder); | 156 DISALLOW_COPY_AND_ASSIGN(ExtensionAppModelBuilder); |
| 153 }; | 157 }; |
| 154 | 158 |
| 155 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_MODEL_BUILDER_H_ | 159 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_MODEL_BUILDER_H_ |
| OLD | NEW |