| 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_APPS_MODEL_BUILDER_H_ |   5 #ifndef CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ | 
|   6 #define CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ |   6 #define CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ | 
|   7  |   7  | 
|   8 #include <string> |   8 #include <string> | 
|   9  |   9  | 
|  10 #include "base/gtest_prod_util.h" |  10 #include "base/gtest_prod_util.h" | 
|  11 #include "base/prefs/public/pref_change_registrar.h" |  11 #include "base/prefs/public/pref_change_registrar.h" | 
|  12 #include "base/prefs/public/pref_observer.h" |  | 
|  13 #include "content/public/browser/notification_observer.h" |  12 #include "content/public/browser/notification_observer.h" | 
|  14 #include "content/public/browser/notification_registrar.h" |  13 #include "content/public/browser/notification_registrar.h" | 
|  15 #include "ui/app_list/app_list_model.h" |  14 #include "ui/app_list/app_list_model.h" | 
|  16 #include "ui/base/models/list_model_observer.h" |  15 #include "ui/base/models/list_model_observer.h" | 
|  17  |  16  | 
|  18 class AppListControllerDelegate; |  17 class AppListControllerDelegate; | 
|  19 class ExtensionAppItem; |  18 class ExtensionAppItem; | 
|  20 class Profile; |  19 class Profile; | 
|  21  |  20  | 
|  22 class AppsModelBuilder : public content::NotificationObserver, |  21 class AppsModelBuilder : public content::NotificationObserver, | 
|  23                          public PrefObserver, |  | 
|  24                          public ui::ListModelObserver { |  22                          public ui::ListModelObserver { | 
|  25  public: |  23  public: | 
|  26   AppsModelBuilder(Profile* profile, |  24   AppsModelBuilder(Profile* profile, | 
|  27                    app_list::AppListModel::Apps* model, |  25                    app_list::AppListModel::Apps* model, | 
|  28                    AppListControllerDelegate* controller); |  26                    AppListControllerDelegate* controller); | 
|  29   virtual ~AppsModelBuilder(); |  27   virtual ~AppsModelBuilder(); | 
|  30  |  28  | 
|  31   // Populates the model. |  29   // Populates the model. | 
|  32   void Build(); |  30   void Build(); | 
|  33  |  31  | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|  51   void HighlightApp(); |  49   void HighlightApp(); | 
|  52  |  50  | 
|  53   // Returns app instance at given |index|. |  51   // Returns app instance at given |index|. | 
|  54   ExtensionAppItem* GetAppAt(size_t index); |  52   ExtensionAppItem* GetAppAt(size_t index); | 
|  55  |  53  | 
|  56   // content::NotificationObserver |  54   // content::NotificationObserver | 
|  57   virtual void Observe(int type, |  55   virtual void Observe(int type, | 
|  58                        const content::NotificationSource& source, |  56                        const content::NotificationSource& source, | 
|  59                        const content::NotificationDetails& details) OVERRIDE; |  57                        const content::NotificationDetails& details) OVERRIDE; | 
|  60  |  58  | 
|  61   // PrefObserver |  | 
|  62   virtual void OnPreferenceChanged(PrefServiceBase* service, |  | 
|  63                                    const std::string& pref_name) OVERRIDE; |  | 
|  64  |  | 
|  65   // ui::ListModelObserver overrides: |  59   // ui::ListModelObserver overrides: | 
|  66   virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; |  60   virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; | 
|  67   virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; |  61   virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; | 
|  68   virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; |  62   virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; | 
|  69   virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; |  63   virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; | 
|  70  |  64  | 
|  71   Profile* profile_; |  65   Profile* profile_; | 
|  72   AppListControllerDelegate* controller_; |  66   AppListControllerDelegate* controller_; | 
|  73  |  67  | 
|  74   // Sub apps model of AppListModel that represents apps grid view. |  68   // Sub apps model of AppListModel that represents apps grid view. | 
|  75   app_list::AppListModel::Apps* model_; |  69   app_list::AppListModel::Apps* model_; | 
|  76  |  70  | 
|  77   std::string highlight_app_id_; |  71   std::string highlight_app_id_; | 
|  78  |  72  | 
|  79   // True to ignore |model_| changes. |  73   // True to ignore |model_| changes. | 
|  80   bool ignore_changes_; |  74   bool ignore_changes_; | 
|  81  |  75  | 
|  82   content::NotificationRegistrar registrar_; |  76   content::NotificationRegistrar registrar_; | 
|  83   PrefChangeRegistrar pref_change_registrar_; |  77   PrefChangeRegistrar pref_change_registrar_; | 
|  84  |  78  | 
|  85   DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder); |  79   DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder); | 
|  86 }; |  80 }; | 
|  87  |  81  | 
|  88 #endif  // CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ |  82 #endif  // CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ | 
| OLD | NEW |