Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: chrome/browser/ui/app_list/apps_model_builder.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
12 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
14 #include "ui/app_list/app_list_model.h" 15 #include "ui/app_list/app_list_model.h"
15 #include "ui/base/models/list_model_observer.h" 16 #include "ui/base/models/list_model_observer.h"
16 17
17 class AppListControllerDelegate; 18 class AppListControllerDelegate;
18 class ExtensionAppItem; 19 class ExtensionAppItem;
19 class Profile; 20 class Profile;
20 21
21 class AppsModelBuilder : public content::NotificationObserver, 22 class AppsModelBuilder : public content::NotificationObserver,
23 public PrefObserver,
22 public ui::ListModelObserver { 24 public ui::ListModelObserver {
23 public: 25 public:
24 AppsModelBuilder(Profile* profile, 26 AppsModelBuilder(Profile* profile,
25 app_list::AppListModel::Apps* model, 27 app_list::AppListModel::Apps* model,
26 AppListControllerDelegate* controller); 28 AppListControllerDelegate* controller);
27 virtual ~AppsModelBuilder(); 29 virtual ~AppsModelBuilder();
28 30
29 // Populates the model. 31 // Populates the model.
30 void Build(); 32 void Build();
31 33
(...skipping 17 matching lines...) Expand all
49 void HighlightApp(); 51 void HighlightApp();
50 52
51 // Returns app instance at given |index|. 53 // Returns app instance at given |index|.
52 ExtensionAppItem* GetAppAt(size_t index); 54 ExtensionAppItem* GetAppAt(size_t index);
53 55
54 // content::NotificationObserver 56 // content::NotificationObserver
55 virtual void Observe(int type, 57 virtual void Observe(int type,
56 const content::NotificationSource& source, 58 const content::NotificationSource& source,
57 const content::NotificationDetails& details) OVERRIDE; 59 const content::NotificationDetails& details) OVERRIDE;
58 60
61 // PrefObserver
62 virtual void OnPreferenceChanged(PrefServiceBase* service,
63 const std::string& pref_name) OVERRIDE;
64
59 // ui::ListModelObserver overrides: 65 // ui::ListModelObserver overrides:
60 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE; 66 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE;
61 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE; 67 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE;
62 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE; 68 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE;
63 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE; 69 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE;
64 70
65 Profile* profile_; 71 Profile* profile_;
66 AppListControllerDelegate* controller_; 72 AppListControllerDelegate* controller_;
67 73
68 // Sub apps model of AppListModel that represents apps grid view. 74 // Sub apps model of AppListModel that represents apps grid view.
69 app_list::AppListModel::Apps* model_; 75 app_list::AppListModel::Apps* model_;
70 76
71 std::string highlight_app_id_; 77 std::string highlight_app_id_;
72 78
73 // True to ignore |model_| changes. 79 // True to ignore |model_| changes.
74 bool ignore_changes_; 80 bool ignore_changes_;
75 81
76 content::NotificationRegistrar registrar_; 82 content::NotificationRegistrar registrar_;
77 PrefChangeRegistrar pref_change_registrar_; 83 PrefChangeRegistrar pref_change_registrar_;
78 84
79 DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder); 85 DISALLOW_COPY_AND_ASSIGN(AppsModelBuilder);
80 }; 86 };
81 87
82 #endif // CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_ 88 #endif // CHROME_BROWSER_UI_APP_LIST_APPS_MODEL_BUILDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/alternate_error_tab_observer.cc ('k') | chrome/browser/ui/app_list/apps_model_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698