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

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

Issue 24707002: Add unit tests for AppListServiceImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_APP_LIST_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_info_cache_observer.h" 15 #include "chrome/browser/profiles/profile_info_cache_observer.h"
16 #include "chrome/browser/profiles/profile_loader.h"
17 #include "chrome/browser/ui/app_list/app_list_service.h" 16 #include "chrome/browser/ui/app_list/app_list_service.h"
17 #include "chrome/browser/ui/app_list/keep_alive_service.h"
18 #include "chrome/browser/ui/app_list/profile_loader.h"
19
20 class ProfileStore;
18 21
19 namespace base { 22 namespace base {
20 class FilePath; 23 class FilePath;
21 } 24 }
22 25
23 // Parts of the AppListService implementation shared between platforms. 26 // Parts of the AppListService implementation shared between platforms.
24 class AppListServiceImpl : public AppListService, 27 class AppListServiceImpl : public AppListService,
25 public ProfileInfoCacheObserver { 28 public ProfileInfoCacheObserver {
26 public: 29 public:
27 static void RecordAppListLaunch(); 30 static void RecordAppListLaunch();
28 static void RecordAppListAppLaunch(); 31 static void RecordAppListAppLaunch();
32 virtual ~AppListServiceImpl();
29 33
30 protected:
31 AppListServiceImpl(); 34 AppListServiceImpl();
32 virtual ~AppListServiceImpl(); 35 // Constructor used for testing.
36 AppListServiceImpl(PrefService* local_state,
37 scoped_ptr<ProfileStore> profile_store,
38 scoped_ptr<KeepAliveService> keep_alive_service);
33 39
34 Profile* profile() const { return profile_; } 40 Profile* profile() const { return profile_; }
35 void SetProfile(Profile* new_profile); 41 void SetProfile(Profile* new_profile);
36 void InvalidatePendingProfileLoads(); 42 void InvalidatePendingProfileLoads();
37 ProfileLoader& profile_loader() { return profile_loader_; } 43 ProfileLoader& profile_loader() { return *profile_loader_; }
38 const ProfileLoader& profile_loader() const { return profile_loader_; } 44 const ProfileLoader& profile_loader() const { return *profile_loader_; }
39 45
40 // Process command line flags shared between desktop implementations of the 46 // Process command line flags shared between desktop implementations of the
41 // app list. Currently this allows for enabling or disabling the app list. 47 // app list. Currently this allows for enabling or disabling the app list.
42 void HandleCommandLineFlags(Profile* initial_profile); 48 void HandleCommandLineFlags(Profile* initial_profile);
43 49
44 // Create a platform-specific shortcut for the app list. 50 // Create a platform-specific shortcut for the app list.
45 virtual void CreateShortcut(); 51 virtual void CreateShortcut();
46 52
47 // AppListService overrides: 53 // AppListService overrides:
48 virtual void SetAppListNextPaintCallback( 54 virtual void SetAppListNextPaintCallback(
(...skipping 20 matching lines...) Expand all
69 Profile::CreateStatus status); 75 Profile::CreateStatus status);
70 76
71 virtual Profile* GetCurrentAppListProfile() OVERRIDE; 77 virtual Profile* GetCurrentAppListProfile() OVERRIDE;
72 78
73 // ProfileInfoCacheObserver overrides: 79 // ProfileInfoCacheObserver overrides:
74 virtual void OnProfileWillBeRemoved( 80 virtual void OnProfileWillBeRemoved(
75 const base::FilePath& profile_path) OVERRIDE; 81 const base::FilePath& profile_path) OVERRIDE;
76 82
77 // The profile the AppList is currently displaying. 83 // The profile the AppList is currently displaying.
78 Profile* profile_; 84 Profile* profile_;
79 85 scoped_ptr<ProfileStore> profile_store_;
80 // Incremented to indicate that pending profile loads are no longer valid.
81 int profile_load_sequence_id_;
82
83 // How many profile loads are pending.
84 int pending_profile_loads_;
85 86
86 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; 87 base::WeakPtrFactory<AppListServiceImpl> weak_factory_;
87 88
88 ProfileLoader profile_loader_; 89 PrefService* local_state_;
90 scoped_ptr<ProfileLoader> profile_loader_;
89 91
90 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); 92 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl);
91 }; 93 };
92 94
93 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ 95 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698