| OLD | NEW |
| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 // Remove the profile from our map of profiles. | 428 // Remove the profile from our map of profiles. |
| 429 BackgroundModeInfoMap::iterator it = | 429 BackgroundModeInfoMap::iterator it = |
| 430 GetBackgroundModeIterator(profile_name); | 430 GetBackgroundModeIterator(profile_name); |
| 431 // If a profile isn't running a background app, it may not be in the map. | 431 // If a profile isn't running a background app, it may not be in the map. |
| 432 if (it != background_mode_data_.end()) { | 432 if (it != background_mode_data_.end()) { |
| 433 background_mode_data_.erase(it); | 433 background_mode_data_.erase(it); |
| 434 UpdateStatusTrayIconContextMenu(); | 434 UpdateStatusTrayIconContextMenu(); |
| 435 } | 435 } |
| 436 } | 436 } |
| 437 | 437 |
| 438 void BackgroundModeManager::OnProfileWasRemoved( | |
| 439 const base::FilePath& profile_path, | |
| 440 const string16& profile_name) { | |
| 441 } | |
| 442 | |
| 443 void BackgroundModeManager::OnProfileNameChanged( | 438 void BackgroundModeManager::OnProfileNameChanged( |
| 444 const base::FilePath& profile_path, | 439 const base::FilePath& profile_path, |
| 445 const string16& old_profile_name) { | 440 const string16& old_profile_name) { |
| 446 ProfileInfoCache& cache = | 441 ProfileInfoCache& cache = |
| 447 g_browser_process->profile_manager()->GetProfileInfoCache(); | 442 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 448 string16 new_profile_name = cache.GetNameOfProfileAtIndex( | 443 string16 new_profile_name = cache.GetNameOfProfileAtIndex( |
| 449 cache.GetIndexOfProfileWithPath(profile_path)); | 444 cache.GetIndexOfProfileWithPath(profile_path)); |
| 450 BackgroundModeInfoMap::const_iterator it = | 445 BackgroundModeInfoMap::const_iterator it = |
| 451 GetBackgroundModeIterator(old_profile_name); | 446 GetBackgroundModeIterator(old_profile_name); |
| 452 // We check that the returned iterator is valid due to unittests, but really | 447 // We check that the returned iterator is valid due to unittests, but really |
| 453 // this should only be called on profiles already known by the background | 448 // this should only be called on profiles already known by the background |
| 454 // mode manager. | 449 // mode manager. |
| 455 if (it != background_mode_data_.end()) { | 450 if (it != background_mode_data_.end()) { |
| 456 it->second->SetName(new_profile_name); | 451 it->second->SetName(new_profile_name); |
| 457 UpdateStatusTrayIconContextMenu(); | 452 UpdateStatusTrayIconContextMenu(); |
| 458 } | 453 } |
| 459 } | 454 } |
| 460 | 455 |
| 461 void BackgroundModeManager::OnProfileAvatarChanged( | |
| 462 const base::FilePath& profile_path) { | |
| 463 | |
| 464 } | |
| 465 /////////////////////////////////////////////////////////////////////////////// | 456 /////////////////////////////////////////////////////////////////////////////// |
| 466 // BackgroundModeManager::BackgroundModeData, ui::SimpleMenuModel overrides | 457 // BackgroundModeManager::BackgroundModeData, ui::SimpleMenuModel overrides |
| 467 bool BackgroundModeManager::IsCommandIdChecked( | 458 bool BackgroundModeManager::IsCommandIdChecked( |
| 468 int command_id) const { | 459 int command_id) const { |
| 469 DCHECK(command_id == IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND); | 460 DCHECK(command_id == IDC_STATUS_TRAY_KEEP_CHROME_RUNNING_IN_BACKGROUND); |
| 470 return true; | 461 return true; |
| 471 } | 462 } |
| 472 | 463 |
| 473 bool BackgroundModeManager::IsCommandIdEnabled( | 464 bool BackgroundModeManager::IsCommandIdEnabled( |
| 474 int command_id) const { | 465 int command_id) const { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 } | 756 } |
| 766 } | 757 } |
| 767 return profile_it; | 758 return profile_it; |
| 768 } | 759 } |
| 769 | 760 |
| 770 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { | 761 bool BackgroundModeManager::IsBackgroundModePrefEnabled() const { |
| 771 PrefService* service = g_browser_process->local_state(); | 762 PrefService* service = g_browser_process->local_state(); |
| 772 DCHECK(service); | 763 DCHECK(service); |
| 773 return service->GetBoolean(prefs::kBackgroundModeEnabled); | 764 return service->GetBoolean(prefs::kBackgroundModeEnabled); |
| 774 } | 765 } |
| OLD | NEW |