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

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

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 #include "chrome/browser/ui/app_list/app_list_service_impl.h" 5 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 } 81 }
82 82
83 class ProfileStoreImpl : public ProfileStore { 83 class ProfileStoreImpl : public ProfileStore {
84 public: 84 public:
85 explicit ProfileStoreImpl(ProfileManager* profile_manager) 85 explicit ProfileStoreImpl(ProfileManager* profile_manager)
86 : profile_manager_(profile_manager), 86 : profile_manager_(profile_manager),
87 weak_factory_(this) { 87 weak_factory_(this) {
88 } 88 }
89 89
90 virtual void AddProfileObserver(ProfileInfoCacheObserver* observer) override { 90 void AddProfileObserver(ProfileInfoCacheObserver* observer) override {
91 profile_manager_->GetProfileInfoCache().AddObserver(observer); 91 profile_manager_->GetProfileInfoCache().AddObserver(observer);
92 } 92 }
93 93
94 virtual void LoadProfileAsync( 94 void LoadProfileAsync(const base::FilePath& path,
95 const base::FilePath& path, 95 base::Callback<void(Profile*)> callback) override {
96 base::Callback<void(Profile*)> callback) override {
97 profile_manager_->CreateProfileAsync( 96 profile_manager_->CreateProfileAsync(
98 path, 97 path,
99 base::Bind(&ProfileStoreImpl::OnProfileCreated, 98 base::Bind(&ProfileStoreImpl::OnProfileCreated,
100 weak_factory_.GetWeakPtr(), 99 weak_factory_.GetWeakPtr(),
101 callback), 100 callback),
102 base::string16(), 101 base::string16(),
103 base::string16(), 102 base::string16(),
104 std::string()); 103 std::string());
105 } 104 }
106 105
107 void OnProfileCreated(base::Callback<void(Profile*)> callback, 106 void OnProfileCreated(base::Callback<void(Profile*)> callback,
108 Profile* profile, 107 Profile* profile,
109 Profile::CreateStatus status) { 108 Profile::CreateStatus status) {
110 switch (status) { 109 switch (status) {
111 case Profile::CREATE_STATUS_CREATED: 110 case Profile::CREATE_STATUS_CREATED:
112 break; 111 break;
113 case Profile::CREATE_STATUS_INITIALIZED: 112 case Profile::CREATE_STATUS_INITIALIZED:
114 callback.Run(profile); 113 callback.Run(profile);
115 break; 114 break;
116 case Profile::CREATE_STATUS_LOCAL_FAIL: 115 case Profile::CREATE_STATUS_LOCAL_FAIL:
117 case Profile::CREATE_STATUS_REMOTE_FAIL: 116 case Profile::CREATE_STATUS_REMOTE_FAIL:
118 case Profile::CREATE_STATUS_CANCELED: 117 case Profile::CREATE_STATUS_CANCELED:
119 break; 118 break;
120 case Profile::MAX_CREATE_STATUS: 119 case Profile::MAX_CREATE_STATUS:
121 NOTREACHED(); 120 NOTREACHED();
122 break; 121 break;
123 } 122 }
124 } 123 }
125 124
126 virtual Profile* GetProfileByPath(const base::FilePath& path) override { 125 Profile* GetProfileByPath(const base::FilePath& path) override {
127 return profile_manager_->GetProfileByPath(path); 126 return profile_manager_->GetProfileByPath(path);
128 } 127 }
129 128
130 virtual base::FilePath GetUserDataDir() override { 129 base::FilePath GetUserDataDir() override {
131 return profile_manager_->user_data_dir(); 130 return profile_manager_->user_data_dir();
132 } 131 }
133 132
134 virtual bool IsProfileSupervised( 133 bool IsProfileSupervised(const base::FilePath& profile_path) override {
135 const base::FilePath& profile_path) override {
136 ProfileInfoCache& profile_info = 134 ProfileInfoCache& profile_info =
137 g_browser_process->profile_manager()->GetProfileInfoCache(); 135 g_browser_process->profile_manager()->GetProfileInfoCache();
138 size_t profile_index = profile_info.GetIndexOfProfileWithPath(profile_path); 136 size_t profile_index = profile_info.GetIndexOfProfileWithPath(profile_path);
139 return profile_index != std::string::npos && 137 return profile_index != std::string::npos &&
140 profile_info.ProfileIsSupervisedAtIndex(profile_index); 138 profile_info.ProfileIsSupervisedAtIndex(profile_index);
141 } 139 }
142 140
143 private: 141 private:
144 ProfileManager* profile_manager_; 142 ProfileManager* profile_manager_;
145 base::WeakPtrFactory<ProfileStoreImpl> weak_factory_; 143 base::WeakPtrFactory<ProfileStoreImpl> weak_factory_;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 if (!base::MessageLoop::current()) 407 if (!base::MessageLoop::current())
410 return; // In a unit test. 408 return; // In a unit test.
411 409
412 // Send app list usage stats after a delay. 410 // Send app list usage stats after a delay.
413 const int kSendUsageStatsDelay = 5; 411 const int kSendUsageStatsDelay = 5;
414 base::MessageLoop::current()->PostDelayedTask( 412 base::MessageLoop::current()->PostDelayedTask(
415 FROM_HERE, 413 FROM_HERE,
416 base::Bind(&AppListServiceImpl::SendAppListStats), 414 base::Bind(&AppListServiceImpl::SendAppListStats),
417 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); 415 base::TimeDelta::FromSeconds(kSendUsageStatsDelay));
418 } 416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698