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

Side by Side Diff: chrome/browser/jumplist_win.h

Issue 845013002: Remove TopSites notification in favor of Observers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing typo causing compilation issues on win Created 5 years, 11 months 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
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_JUMPLIST_WIN_H_ 5 #ifndef CHROME_BROWSER_JUMPLIST_WIN_H_
6 #define CHROME_BROWSER_JUMPLIST_WIN_H_ 6 #define CHROME_BROWSER_JUMPLIST_WIN_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "base/task/cancelable_task_tracker.h" 16 #include "base/task/cancelable_task_tracker.h"
17 #include "chrome/browser/history/history_service.h" 17 #include "chrome/browser/history/history_service.h"
18 #include "chrome/browser/jumplist_updater_win.h" 18 #include "chrome/browser/jumplist_updater_win.h"
19 #include "chrome/browser/prefs/incognito_mode_prefs.h" 19 #include "chrome/browser/prefs/incognito_mode_prefs.h"
20 #include "chrome/browser/profiles/avatar_menu.h" 20 #include "chrome/browser/profiles/avatar_menu.h"
21 #include "chrome/browser/profiles/avatar_menu_observer.h" 21 #include "chrome/browser/profiles/avatar_menu_observer.h"
22 #include "chrome/browser/sessions/tab_restore_service.h" 22 #include "chrome/browser/sessions/tab_restore_service.h"
23 #include "chrome/browser/sessions/tab_restore_service_observer.h" 23 #include "chrome/browser/sessions/tab_restore_service_observer.h"
24 #include "components/history/core/browser/history_types.h" 24 #include "components/history/core/browser/history_types.h"
25 #include "components/history/core/browser/top_sites_observer.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 27
27 namespace chrome { 28 namespace chrome {
28 struct FaviconImageResult; 29 struct FaviconImageResult;
29 } 30 }
30 31
31 namespace content { 32 namespace content {
32 class NotificationRegistrar; 33 class NotificationRegistrar;
33 } 34 }
34 35
(...skipping 14 matching lines...) Expand all
49 // 50 //
50 // Updating a JumpList requires some file operations and it is not good to 51 // Updating a JumpList requires some file operations and it is not good to
51 // update it in a UI thread. To solve this problem, this class posts to a 52 // update it in a UI thread. To solve this problem, this class posts to a
52 // runnable method when it actually updates a JumpList. 53 // runnable method when it actually updates a JumpList.
53 // 54 //
54 // Note. base::CancelableTaskTracker is not thread safe, so we 55 // Note. base::CancelableTaskTracker is not thread safe, so we
55 // always delete JumpList on UI thread (the same thread it got constructed on). 56 // always delete JumpList on UI thread (the same thread it got constructed on).
56 class JumpList : public TabRestoreServiceObserver, 57 class JumpList : public TabRestoreServiceObserver,
57 public content::NotificationObserver, 58 public content::NotificationObserver,
58 public AvatarMenuObserver, 59 public AvatarMenuObserver,
60 public history::TopSitesObserver,
59 public base::RefCountedThreadSafe< 61 public base::RefCountedThreadSafe<
60 JumpList, content::BrowserThread::DeleteOnUIThread> { 62 JumpList,
63 content::BrowserThread::DeleteOnUIThread> {
61 public: 64 public:
62 explicit JumpList(Profile* profile); 65 explicit JumpList(Profile* profile);
63 66
64 // NotificationObserver implementation. 67 // NotificationObserver implementation.
65 void Observe(int type, 68 void Observe(int type,
66 const content::NotificationSource& source, 69 const content::NotificationSource& source,
67 const content::NotificationDetails& details) override; 70 const content::NotificationDetails& details) override;
68 71
69 // Observer callback for TabRestoreService::Observer to notify when a tab is 72 // Observer callback for TabRestoreService::Observer to notify when a tab is
70 // added or removed. 73 // added or removed.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 IncognitoModePrefs::Availability incognito_availability); 141 IncognitoModePrefs::Availability incognito_availability);
139 142
140 // Helper method for RunUpdate to create icon files for the asynchrounously 143 // Helper method for RunUpdate to create icon files for the asynchrounously
141 // loaded icons. 144 // loaded icons.
142 void CreateIconFiles(const ShellLinkItemList& item_list); 145 void CreateIconFiles(const ShellLinkItemList& item_list);
143 146
144 // Called when the list of Profiles has changed. This function updates the 147 // Called when the list of Profiles has changed. This function updates the
145 // |profile_switcher_| ShellLinkItemList. 148 // |profile_switcher_| ShellLinkItemList.
146 void UpdateProfileSwitcher(); 149 void UpdateProfileSwitcher();
147 150
151 // history::TopSitesObserver implementation.
152 void TopSitesLoaded(history::TopSites* top_sites) override;
153 void TopSitesChanged(history::TopSites* top_sites) override;
154
148 // Tracks FaviconService tasks. 155 // Tracks FaviconService tasks.
149 base::CancelableTaskTracker cancelable_task_tracker_; 156 base::CancelableTaskTracker cancelable_task_tracker_;
150 157
151 // The Profile object is used to listen for events 158 // The Profile object is used to listen for events
152 Profile* profile_; 159 Profile* profile_;
153 160
154 // Lives on the UI thread. 161 // Lives on the UI thread.
155 scoped_ptr<content::NotificationRegistrar> registrar_; 162 scoped_ptr<content::NotificationRegistrar> registrar_;
156 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; 163 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
157 164
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 scoped_ptr<AvatarMenu> avatar_menu_; 200 scoped_ptr<AvatarMenu> avatar_menu_;
194 201
195 // Whether the experiment that is replacing "Most Visited" category with a 202 // Whether the experiment that is replacing "Most Visited" category with a
196 // "People" category is enabled. 203 // "People" category is enabled.
197 bool use_profiles_category_; 204 bool use_profiles_category_;
198 205
199 DISALLOW_COPY_AND_ASSIGN(JumpList); 206 DISALLOW_COPY_AND_ASSIGN(JumpList);
200 }; 207 };
201 208
202 #endif // CHROME_BROWSER_JUMPLIST_WIN_H_ 209 #endif // CHROME_BROWSER_JUMPLIST_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698