Commit 1e9f6a75 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Remove DISALLOW_COPY_AND_ASSIGN from more profile classes

Other miscellaneous cleanup, no functional changes.

Bug: 1010217
Change-Id: I6b86bf6467d360d2e8a7732f350b4c4a9b8427f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363671
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799906}
parent d5813383
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef CHROME_BROWSER_PROFILES_CHROME_BROWSER_MAIN_EXTRA_PARTS_PROFILES_H_ #ifndef CHROME_BROWSER_PROFILES_CHROME_BROWSER_MAIN_EXTRA_PARTS_PROFILES_H_
#define CHROME_BROWSER_PROFILES_CHROME_BROWSER_MAIN_EXTRA_PARTS_PROFILES_H_ #define CHROME_BROWSER_PROFILES_CHROME_BROWSER_MAIN_EXTRA_PARTS_PROFILES_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h" #include "chrome/browser/chrome_browser_main_extra_parts.h"
class ChromeBrowserMainParts; class ChromeBrowserMainParts;
...@@ -18,6 +16,10 @@ void AddProfilesExtraParts(ChromeBrowserMainParts* main_parts); ...@@ -18,6 +16,10 @@ void AddProfilesExtraParts(ChromeBrowserMainParts* main_parts);
class ChromeBrowserMainExtraPartsProfiles : public ChromeBrowserMainExtraParts { class ChromeBrowserMainExtraPartsProfiles : public ChromeBrowserMainExtraParts {
public: public:
ChromeBrowserMainExtraPartsProfiles(); ChromeBrowserMainExtraPartsProfiles();
ChromeBrowserMainExtraPartsProfiles(
const ChromeBrowserMainExtraPartsProfiles&) = delete;
ChromeBrowserMainExtraPartsProfiles& operator=(
const ChromeBrowserMainExtraPartsProfiles&) = delete;
~ChromeBrowserMainExtraPartsProfiles() override; ~ChromeBrowserMainExtraPartsProfiles() override;
// Instantiates all chrome KeyedService factories, which is // Instantiates all chrome KeyedService factories, which is
...@@ -27,9 +29,6 @@ class ChromeBrowserMainExtraPartsProfiles : public ChromeBrowserMainExtraParts { ...@@ -27,9 +29,6 @@ class ChromeBrowserMainExtraPartsProfiles : public ChromeBrowserMainExtraParts {
// Overridden from ChromeBrowserMainExtraParts: // Overridden from ChromeBrowserMainExtraParts:
void PreProfileInit() override; void PreProfileInit() override;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsProfiles);
}; };
#endif // CHROME_BROWSER_PROFILES_CHROME_BROWSER_MAIN_EXTRA_PARTS_PROFILES_H_ #endif // CHROME_BROWSER_PROFILES_CHROME_BROWSER_MAIN_EXTRA_PARTS_PROFILES_H_
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include <utility> #include <utility>
#include <vector>
#include "base/hash/hash.h" #include "base/hash/hash.h"
#include "base/logging.h" #include "base/logging.h"
...@@ -133,10 +134,7 @@ void ProfileAttributesEntry::RegisterLocalStatePrefs( ...@@ -133,10 +134,7 @@ void ProfileAttributesEntry::RegisterLocalStatePrefs(
registry->RegisterIntegerPref(kNextMetricsBucketIndex, 1); registry->RegisterIntegerPref(kNextMetricsBucketIndex, 1);
} }
ProfileAttributesEntry::ProfileAttributesEntry() ProfileAttributesEntry::ProfileAttributesEntry() = default;
: profile_info_cache_(nullptr),
prefs_(nullptr),
profile_path_(base::FilePath()) {}
void ProfileAttributesEntry::Initialize(ProfileInfoCache* cache, void ProfileAttributesEntry::Initialize(ProfileInfoCache* cache,
const base::FilePath& path, const base::FilePath& path,
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -54,7 +53,9 @@ class ProfileAttributesEntry { ...@@ -54,7 +53,9 @@ class ProfileAttributesEntry {
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
ProfileAttributesEntry(); ProfileAttributesEntry();
virtual ~ProfileAttributesEntry() {} ProfileAttributesEntry(const ProfileAttributesEntry&) = delete;
ProfileAttributesEntry& operator=(const ProfileAttributesEntry&) = delete;
virtual ~ProfileAttributesEntry() = default;
// Returns whether the profile name is the concatenation of the Gaia name and // Returns whether the profile name is the concatenation of the Gaia name and
// of the local profile name. // of the local profile name.
...@@ -307,8 +308,8 @@ class ProfileAttributesEntry { ...@@ -307,8 +308,8 @@ class ProfileAttributesEntry {
// when this class holds the members required to fulfill its own contract. // when this class holds the members required to fulfill its own contract.
size_t profile_index() const; size_t profile_index() const;
ProfileInfoCache* profile_info_cache_; ProfileInfoCache* profile_info_cache_ = nullptr;
PrefService* prefs_; PrefService* prefs_ = nullptr;
base::FilePath profile_path_; base::FilePath profile_path_;
std::string storage_key_; std::string storage_key_;
base::string16 last_name_to_display_; base::string16 last_name_to_display_;
...@@ -318,8 +319,6 @@ class ProfileAttributesEntry { ...@@ -318,8 +319,6 @@ class ProfileAttributesEntry {
// memory only and can be easily reset once the policy is turned off. // memory only and can be easily reset once the policy is turned off.
bool is_force_signin_profile_locked_ = false; bool is_force_signin_profile_locked_ = false;
bool is_force_signin_enabled_; bool is_force_signin_enabled_;
DISALLOW_COPY_AND_ASSIGN(ProfileAttributesEntry);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_ENTRY_H_
...@@ -149,7 +149,7 @@ bool ProfileAttributesSortComparator::operator()( ...@@ -149,7 +149,7 @@ bool ProfileAttributesSortComparator::operator()(
MultiProfileUserType GetMultiProfileUserType( MultiProfileUserType GetMultiProfileUserType(
const std::vector<ProfileAttributesEntry*>& entries) { const std::vector<ProfileAttributesEntry*>& entries) {
DCHECK(entries.size() > 0); DCHECK_GT(entries.size(), 0u);
if (entries.size() == 1u) if (entries.size() == 1u)
return MultiProfileUserType::kSingleProfile; return MultiProfileUserType::kSingleProfile;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
...@@ -41,6 +40,8 @@ class ProfileAttributesStorage ...@@ -41,6 +40,8 @@ class ProfileAttributesStorage
using Observer = ProfileInfoCacheObserver; using Observer = ProfileInfoCacheObserver;
explicit ProfileAttributesStorage(PrefService* prefs); explicit ProfileAttributesStorage(PrefService* prefs);
ProfileAttributesStorage(const ProfileAttributesStorage&) = delete;
ProfileAttributesStorage& operator=(const ProfileAttributesStorage&) = delete;
virtual ~ProfileAttributesStorage(); virtual ~ProfileAttributesStorage();
// If the |supervised_user_id| is non-empty, the profile will be marked to be // If the |supervised_user_id| is non-empty, the profile will be marked to be
...@@ -210,8 +211,6 @@ class ProfileAttributesStorage ...@@ -210,8 +211,6 @@ class ProfileAttributesStorage
// Notifies observers. // Notifies observers.
void NotifyOnProfileHighResAvatarLoaded( void NotifyOnProfileHighResAvatarLoaded(
const base::FilePath& profile_path) const; const base::FilePath& profile_path) const;
DISALLOW_COPY_AND_ASSIGN(ProfileAttributesStorage);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_STORAGE_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_ATTRIBUTES_STORAGE_H_
...@@ -68,7 +68,7 @@ ProfileInfoCache::ProfileInfoCache(PrefService* prefs, ...@@ -68,7 +68,7 @@ ProfileInfoCache::ProfileInfoCache(PrefService* prefs,
base::DictionaryValue* cache = update.Get(); base::DictionaryValue* cache = update.Get();
for (base::DictionaryValue::Iterator it(*cache); for (base::DictionaryValue::Iterator it(*cache);
!it.IsAtEnd(); it.Advance()) { !it.IsAtEnd(); it.Advance()) {
base::DictionaryValue* info = NULL; base::DictionaryValue* info = nullptr;
cache->GetDictionaryWithoutPathExpansion(it.key(), &info); cache->GetDictionaryWithoutPathExpansion(it.key(), &info);
#if BUILDFLAG(ENABLE_SUPERVISED_USERS) && !defined(OS_ANDROID) && \ #if BUILDFLAG(ENABLE_SUPERVISED_USERS) && !defined(OS_ANDROID) && \
!defined(OS_CHROMEOS) !defined(OS_CHROMEOS)
...@@ -239,7 +239,7 @@ void ProfileInfoCache::DeleteProfileFromCache( ...@@ -239,7 +239,7 @@ void ProfileInfoCache::DeleteProfileFromCache(
DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache); DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
base::DictionaryValue* cache = update.Get(); base::DictionaryValue* cache = update.Get();
std::string key = CacheKeyFromProfilePath(profile_path); std::string key = CacheKeyFromProfilePath(profile_path);
cache->Remove(key, NULL); cache->Remove(key, nullptr);
keys_.erase(std::find(keys_.begin(), keys_.end(), key)); keys_.erase(std::find(keys_.begin(), keys_.end(), key));
profile_attributes_entries_.erase(profile_path.value()); profile_attributes_entries_.erase(profile_path.value());
...@@ -280,7 +280,7 @@ const gfx::Image* ProfileInfoCache::GetGAIAPictureOfProfileAtIndex( ...@@ -280,7 +280,7 @@ const gfx::Image* ProfileInfoCache::GetGAIAPictureOfProfileAtIndex(
// If the picture is not on disk then return NULL. // If the picture is not on disk then return NULL.
if (file_name.empty()) if (file_name.empty())
return NULL; return nullptr;
base::FilePath image_path = path.AppendASCII(file_name); base::FilePath image_path = path.AppendASCII(file_name);
return LoadAvatarPictureFromPath(path, key, image_path); return LoadAvatarPictureFromPath(path, key, image_path);
...@@ -497,7 +497,7 @@ const base::DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex( ...@@ -497,7 +497,7 @@ const base::DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex(
DCHECK_LT(index, GetNumberOfProfiles()); DCHECK_LT(index, GetNumberOfProfiles());
const base::DictionaryValue* cache = const base::DictionaryValue* cache =
prefs_->GetDictionary(prefs::kProfileInfoCache); prefs_->GetDictionary(prefs::kProfileInfoCache);
const base::DictionaryValue* info = NULL; const base::DictionaryValue* info = nullptr;
cache->GetDictionaryWithoutPathExpansion(keys_[index], &info); cache->GetDictionaryWithoutPathExpansion(keys_[index], &info);
return info; return info;
} }
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
...@@ -48,6 +47,8 @@ class ProfileInfoCache : public ProfileInfoInterface, ...@@ -48,6 +47,8 @@ class ProfileInfoCache : public ProfileInfoInterface,
public base::SupportsWeakPtr<ProfileInfoCache> { public base::SupportsWeakPtr<ProfileInfoCache> {
public: public:
ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir); ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir);
ProfileInfoCache(const ProfileInfoCache&) = delete;
ProfileInfoCache& operator=(const ProfileInfoCache&) = delete;
~ProfileInfoCache() override; ~ProfileInfoCache() override;
// If the |supervised_user_id| is non-empty, the profile will be marked to be // If the |supervised_user_id| is non-empty, the profile will be marked to be
...@@ -188,8 +189,6 @@ class ProfileInfoCache : public ProfileInfoInterface, ...@@ -188,8 +189,6 @@ class ProfileInfoCache : public ProfileInfoInterface,
std::vector<std::string> keys_; std::vector<std::string> keys_;
const base::FilePath user_data_dir_; const base::FilePath user_data_dir_;
base::WeakPtrFactory<ProfileInfoCache> weak_factory_{this}; base::WeakPtrFactory<ProfileInfoCache> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment