OLD | NEW |
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if (!view_delegate_) | 290 if (!view_delegate_) |
291 view_delegate_.reset(new AppListViewDelegate(GetControllerDelegate())); | 291 view_delegate_.reset(new AppListViewDelegate(GetControllerDelegate())); |
292 view_delegate_->SetProfile(profile); | 292 view_delegate_->SetProfile(profile); |
293 return view_delegate_.get(); | 293 return view_delegate_.get(); |
294 } | 294 } |
295 | 295 |
296 void AppListServiceImpl::SetAppListNextPaintCallback(void (*callback)()) {} | 296 void AppListServiceImpl::SetAppListNextPaintCallback(void (*callback)()) {} |
297 | 297 |
298 void AppListServiceImpl::Init(Profile* initial_profile) {} | 298 void AppListServiceImpl::Init(Profile* initial_profile) {} |
299 | 299 |
300 base::FilePath AppListServiceImpl::GetProfilePath( | 300 base::FilePath AppListServiceImpl::GetProfilePath() { |
301 const base::FilePath& user_data_dir) { | 301 return profile_store_->GetUserDataDir().AppendASCII(GetProfileName()); |
302 return user_data_dir.AppendASCII(GetProfileName()); | |
303 } | 302 } |
304 | 303 |
305 void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) { | 304 void AppListServiceImpl::SetProfilePath(const base::FilePath& profile_path) { |
306 local_state_->SetString( | 305 local_state_->SetString( |
307 prefs::kAppListProfile, | 306 prefs::kAppListProfile, |
308 profile_path.BaseName().MaybeAsASCII()); | 307 profile_path.BaseName().MaybeAsASCII()); |
309 } | 308 } |
310 | 309 |
311 void AppListServiceImpl::CreateShortcut() {} | 310 void AppListServiceImpl::CreateShortcut() {} |
312 | 311 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 // - this loading is sometimes done by the ProfileManager asynchronously, | 353 // - this loading is sometimes done by the ProfileManager asynchronously, |
355 // so the app list can't just switch to that. | 354 // so the app list can't just switch to that. |
356 // Only Mac supports showing the app list with a NULL profile, so tear down | 355 // Only Mac supports showing the app list with a NULL profile, so tear down |
357 // the view. | 356 // the view. |
358 DestroyAppList(); | 357 DestroyAppList(); |
359 view_delegate_->SetProfile(NULL); | 358 view_delegate_->SetProfile(NULL); |
360 } | 359 } |
361 | 360 |
362 void AppListServiceImpl::Show() { | 361 void AppListServiceImpl::Show() { |
363 profile_loader_->LoadProfileInvalidatingOtherLoads( | 362 profile_loader_->LoadProfileInvalidatingOtherLoads( |
364 GetProfilePath(profile_store_->GetUserDataDir()), | 363 GetProfilePath(), base::Bind(&AppListServiceImpl::ShowForProfile, |
365 base::Bind(&AppListServiceImpl::ShowForProfile, | 364 weak_factory_.GetWeakPtr())); |
366 weak_factory_.GetWeakPtr())); | |
367 } | 365 } |
368 | 366 |
369 void AppListServiceImpl::ShowForVoiceSearch( | 367 void AppListServiceImpl::ShowForVoiceSearch( |
370 Profile* profile, | 368 Profile* profile, |
371 const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble) { | 369 const scoped_refptr<content::SpeechRecognitionSessionPreamble>& preamble) { |
372 ShowForProfile(profile); | 370 ShowForProfile(profile); |
373 view_delegate_->ToggleSpeechRecognitionForHotword(preamble); | 371 view_delegate_->ToggleSpeechRecognitionForHotword(preamble); |
374 } | 372 } |
375 | 373 |
376 void AppListServiceImpl::ShowForAppInstall(Profile* profile, | 374 void AppListServiceImpl::ShowForAppInstall(Profile* profile, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 if (!base::MessageLoop::current()) | 444 if (!base::MessageLoop::current()) |
447 return; // In a unit test. | 445 return; // In a unit test. |
448 | 446 |
449 // Send app list usage stats after a delay. | 447 // Send app list usage stats after a delay. |
450 const int kSendUsageStatsDelay = 5; | 448 const int kSendUsageStatsDelay = 5; |
451 base::MessageLoop::current()->PostDelayedTask( | 449 base::MessageLoop::current()->PostDelayedTask( |
452 FROM_HERE, | 450 FROM_HERE, |
453 base::Bind(&AppListServiceImpl::SendAppListStats), | 451 base::Bind(&AppListServiceImpl::SendAppListStats), |
454 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); | 452 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); |
455 } | 453 } |
OLD | NEW |