Commit 81653888 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Remove DISALLOW_COPY_AND_ASSIGN from more profile classes.

A few other minor cleanups, no functional changes.

Bug: 1010217
Change-Id: I9b14492cbe21699f0d2c1d86f73a4937e599c5c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368414
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801785}
parent 6c42a51f
...@@ -51,4 +51,4 @@ ProfileNotification::ProfileNotification( ...@@ -51,4 +51,4 @@ ProfileNotification::ProfileNotification(
#endif #endif
} }
ProfileNotification::~ProfileNotification() {} ProfileNotification::~ProfileNotification() = default;
...@@ -31,6 +31,8 @@ class ProfileNotification { ...@@ -31,6 +31,8 @@ class ProfileNotification {
Profile* profile, Profile* profile,
const message_center::Notification& notification, const message_center::Notification& notification,
NotificationHandler::Type type = NotificationHandler::Type::MAX); NotificationHandler::Type type = NotificationHandler::Type::MAX);
ProfileNotification(const ProfileNotification&) = delete;
ProfileNotification& operator=(const ProfileNotification&) = delete;
~ProfileNotification(); ~ProfileNotification();
Profile* profile() const { return profile_; } Profile* profile() const { return profile_; }
...@@ -57,8 +59,6 @@ class ProfileNotification { ...@@ -57,8 +59,6 @@ class ProfileNotification {
NotificationHandler::Type type_; NotificationHandler::Type type_;
std::unique_ptr<ScopedKeepAlive> keep_alive_; std::unique_ptr<ScopedKeepAlive> keep_alive_;
DISALLOW_COPY_AND_ASSIGN(ProfileNotification);
}; };
#endif // CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_ #endif // CHROME_BROWSER_NOTIFICATIONS_PROFILE_NOTIFICATION_H_
...@@ -73,6 +73,10 @@ class ProxiedPoliciesPropagatedWatcher : PolicyService::ProviderUpdateObserver { ...@@ -73,6 +73,10 @@ class ProxiedPoliciesPropagatedWatcher : PolicyService::ProviderUpdateObserver {
&ProxiedPoliciesPropagatedWatcher::OnProviderUpdatePropagationTimedOut); &ProxiedPoliciesPropagatedWatcher::OnProviderUpdatePropagationTimedOut);
} }
ProxiedPoliciesPropagatedWatcher(const ProxiedPoliciesPropagatedWatcher&) =
delete;
ProxiedPoliciesPropagatedWatcher& operator=(
const ProxiedPoliciesPropagatedWatcher&) = delete;
~ProxiedPoliciesPropagatedWatcher() override { ~ProxiedPoliciesPropagatedWatcher() override {
device_wide_policy_service_->RemoveProviderUpdateObserver(this); device_wide_policy_service_->RemoveProviderUpdateObserver(this);
} }
...@@ -108,8 +112,6 @@ class ProxiedPoliciesPropagatedWatcher : PolicyService::ProviderUpdateObserver { ...@@ -108,8 +112,6 @@ class ProxiedPoliciesPropagatedWatcher : PolicyService::ProviderUpdateObserver {
const ConfigurationPolicyProvider* const source_policy_provider_; const ConfigurationPolicyProvider* const source_policy_provider_;
base::OnceClosure proxied_policies_propagated_callback_; base::OnceClosure proxied_policies_propagated_callback_;
base::OneShotTimer timeout_timer_; base::OneShotTimer timeout_timer_;
DISALLOW_COPY_AND_ASSIGN(ProxiedPoliciesPropagatedWatcher);
}; };
} // namespace internal } // namespace internal
...@@ -133,9 +135,9 @@ ProxyPolicyProvider* GetProxyPolicyProvider() { ...@@ -133,9 +135,9 @@ ProxyPolicyProvider* GetProxyPolicyProvider() {
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
ProfilePolicyConnector::ProfilePolicyConnector() {} ProfilePolicyConnector::ProfilePolicyConnector() = default;
ProfilePolicyConnector::~ProfilePolicyConnector() {} ProfilePolicyConnector::~ProfilePolicyConnector() = default;
void ProfilePolicyConnector::Init( void ProfilePolicyConnector::Init(
const user_manager::User* user, const user_manager::User* user,
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -39,6 +38,8 @@ class ChromeBrowserPolicyConnector; ...@@ -39,6 +38,8 @@ class ChromeBrowserPolicyConnector;
class ProfilePolicyConnector final { class ProfilePolicyConnector final {
public: public:
ProfilePolicyConnector(); ProfilePolicyConnector();
ProfilePolicyConnector(const ProfilePolicyConnector&) = delete;
ProfilePolicyConnector& operator=(const ProfilePolicyConnector&) = delete;
~ProfilePolicyConnector(); ~ProfilePolicyConnector();
// |user| is only used in Chrome OS builds and should be set to nullptr // |user| is only used in Chrome OS builds and should be set to nullptr
...@@ -164,8 +165,6 @@ class ProfilePolicyConnector final { ...@@ -164,8 +165,6 @@ class ProfilePolicyConnector final {
std::unique_ptr<PolicyService> policy_service_; std::unique_ptr<PolicyService> policy_service_;
std::unique_ptr<bool> is_managed_override_; std::unique_ptr<bool> is_managed_override_;
DISALLOW_COPY_AND_ASSIGN(ProfilePolicyConnector);
}; };
} // namespace policy } // namespace policy
......
...@@ -54,7 +54,7 @@ ProfilePrefStoreManager::ProfilePrefStoreManager( ...@@ -54,7 +54,7 @@ ProfilePrefStoreManager::ProfilePrefStoreManager(
seed_(seed), seed_(seed),
legacy_device_id_(legacy_device_id) {} legacy_device_id_(legacy_device_id) {}
ProfilePrefStoreManager::~ProfilePrefStoreManager() {} ProfilePrefStoreManager::~ProfilePrefStoreManager() = default;
// static // static
void ProfilePrefStoreManager::RegisterProfilePrefs( void ProfilePrefStoreManager::RegisterProfilePrefs(
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <vector> #include <vector>
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
...@@ -47,6 +46,8 @@ class ProfilePrefStoreManager { ...@@ -47,6 +46,8 @@ class ProfilePrefStoreManager {
const std::string& seed, const std::string& seed,
const std::string& legacy_device_id); const std::string& legacy_device_id);
ProfilePrefStoreManager(const ProfilePrefStoreManager&) = delete;
ProfilePrefStoreManager& operator=(const ProfilePrefStoreManager&) = delete;
~ProfilePrefStoreManager(); ~ProfilePrefStoreManager();
static const bool kPlatformSupportsPreferenceTracking; static const bool kPlatformSupportsPreferenceTracking;
...@@ -125,8 +126,6 @@ class ProfilePrefStoreManager { ...@@ -125,8 +126,6 @@ class ProfilePrefStoreManager {
const base::FilePath profile_path_; const base::FilePath profile_path_;
const std::string seed_; const std::string seed_;
const std::string legacy_device_id_; const std::string legacy_device_id_;
DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager);
}; };
#endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_
...@@ -30,7 +30,7 @@ constexpr int kMaxProfileBucket = 100; ...@@ -30,7 +30,7 @@ constexpr int kMaxProfileBucket = 100;
constexpr base::TimeDelta kLongTimeOfInactivity = constexpr base::TimeDelta kLongTimeOfInactivity =
base::TimeDelta::FromMinutes(30); base::TimeDelta::FromMinutes(30);
int GetMetricsBucketIndex(Profile* profile) { int GetMetricsBucketIndex(const Profile* profile) {
if (profile->IsGuestSession()) if (profile->IsGuestSession())
return 0; return 0;
...@@ -46,7 +46,7 @@ int GetMetricsBucketIndex(Profile* profile) { ...@@ -46,7 +46,7 @@ int GetMetricsBucketIndex(Profile* profile) {
return entry->GetMetricsBucketIndex(); return entry->GetMetricsBucketIndex();
} }
void RecordProfileSessionDuration(Profile* profile, void RecordProfileSessionDuration(const Profile* profile,
base::TimeDelta session_length) { base::TimeDelta session_length) {
if (!profile || session_length.InMinutes() <= 0) if (!profile || session_length.InMinutes() <= 0)
return; return;
...@@ -61,7 +61,7 @@ void RecordProfileSessionDuration(Profile* profile, ...@@ -61,7 +61,7 @@ void RecordProfileSessionDuration(Profile* profile,
} }
} }
void RecordBrowserActivation(Profile* profile) { void RecordBrowserActivation(const Profile* profile) {
DCHECK(profile); DCHECK(profile);
int profile_bucket = GetMetricsBucketIndex(profile); int profile_bucket = GetMetricsBucketIndex(profile);
...@@ -71,7 +71,7 @@ void RecordBrowserActivation(Profile* profile) { ...@@ -71,7 +71,7 @@ void RecordBrowserActivation(Profile* profile) {
} }
} }
void RecordUserAction(Profile* profile) { void RecordUserAction(const Profile* profile) {
if (!profile) if (!profile)
return; return;
...@@ -89,7 +89,7 @@ void RecordProfilesState() { ...@@ -89,7 +89,7 @@ void RecordProfilesState() {
.RecordProfilesState(); .RecordProfilesState();
} }
void RecordAccountMetrics(Profile* profile) { void RecordAccountMetrics(const Profile* profile) {
DCHECK(profile); DCHECK(profile);
ProfileAttributesEntry* entry; ProfileAttributesEntry* entry;
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <stddef.h> #include <stddef.h>
#include <string> #include <string>
#include "base/macros.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -24,6 +23,10 @@ class ProfileActivityMetricsRecorder ...@@ -24,6 +23,10 @@ class ProfileActivityMetricsRecorder
public metrics::DesktopSessionDurationTracker::Observer, public metrics::DesktopSessionDurationTracker::Observer,
public ProfileObserver { public ProfileObserver {
public: public:
ProfileActivityMetricsRecorder(const ProfileActivityMetricsRecorder&) =
delete;
ProfileActivityMetricsRecorder& operator=(
const ProfileActivityMetricsRecorder&) = delete;
// Initializes a |ProfileActivityMetricsRecorder| object and starts // Initializes a |ProfileActivityMetricsRecorder| object and starts
// tracking/recording. // tracking/recording.
static void Initialize(); static void Initialize();
...@@ -54,8 +57,6 @@ class ProfileActivityMetricsRecorder ...@@ -54,8 +57,6 @@ class ProfileActivityMetricsRecorder
base::ActionCallback action_callback_; base::ActionCallback action_callback_;
ScopedObserver<Profile, ProfileObserver> profile_observer_{this}; ScopedObserver<Profile, ProfileObserver> profile_observer_{this};
DISALLOW_COPY_AND_ASSIGN(ProfileActivityMetricsRecorder);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_ACTIVITY_METRICS_RECORDER_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_ACTIVITY_METRICS_RECORDER_H_
...@@ -183,7 +183,7 @@ void ProfileDestroyer::RenderProcessHostDestroyed( ...@@ -183,7 +183,7 @@ void ProfileDestroyer::RenderProcessHostDestroyed(
content::RenderProcessHost* host) { content::RenderProcessHost* host) {
TRACE_EVENT2("shutdown", "ProfileDestroyer::RenderProcessHostDestroyed", TRACE_EVENT2("shutdown", "ProfileDestroyer::RenderProcessHostDestroyed",
"profile", profile_, "render_process_host", host); "profile", profile_, "render_process_host", host);
DCHECK(num_hosts_ > 0); DCHECK_GT(num_hosts_, 0u);
--num_hosts_; --num_hosts_;
if (num_hosts_ == 0) { if (num_hosts_ == 0) {
// Delay the destruction one step further in case other observers need to // Delay the destruction one step further in case other observers need to
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <set> #include <set>
#include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "content/public/browser/render_process_host_observer.h" #include "content/public/browser/render_process_host_observer.h"
...@@ -30,6 +29,8 @@ class ProfileDestroyer : public content::RenderProcessHostObserver { ...@@ -30,6 +29,8 @@ class ProfileDestroyer : public content::RenderProcessHostObserver {
// Ownership of the profile is passed to profile destroyer and the profile // Ownership of the profile is passed to profile destroyer and the profile
// should not be used after this call. // should not be used after this call.
static void DestroyProfileWhenAppropriate(Profile* const profile); static void DestroyProfileWhenAppropriate(Profile* const profile);
ProfileDestroyer(const ProfileDestroyer&) = delete;
ProfileDestroyer& operator=(const ProfileDestroyer&) = delete;
private: private:
friend class ProfileImpl; friend class ProfileImpl;
...@@ -78,8 +79,6 @@ class ProfileDestroyer : public content::RenderProcessHostObserver { ...@@ -78,8 +79,6 @@ class ProfileDestroyer : public content::RenderProcessHostObserver {
Profile* profile_; Profile* profile_;
base::WeakPtrFactory<ProfileDestroyer> weak_ptr_factory_{this}; base::WeakPtrFactory<ProfileDestroyer> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ProfileDestroyer);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_DESTROYER_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_DESTROYER_H_
...@@ -43,10 +43,8 @@ constexpr char kAuthorizationHeader[] = "Bearer %s"; ...@@ -43,10 +43,8 @@ constexpr char kAuthorizationHeader[] = "Bearer %s";
ProfileDownloader::ProfileDownloader(ProfileDownloaderDelegate* delegate) ProfileDownloader::ProfileDownloader(ProfileDownloaderDelegate* delegate)
: delegate_(delegate), : delegate_(delegate),
picture_status_(PICTURE_FAILED),
identity_manager_(delegate_->GetIdentityManager()), identity_manager_(delegate_->GetIdentityManager()),
identity_manager_observer_(this), identity_manager_observer_(this) {
waiting_for_account_info_(false) {
DCHECK(delegate_); DCHECK(delegate_);
identity_manager_observer_.Add(identity_manager_); identity_manager_observer_.Add(identity_manager_);
} }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <string> #include <string>
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/scoped_observer.h" #include "base/scoped_observer.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
...@@ -40,6 +39,8 @@ class ProfileDownloader : public ImageDecoder::ImageRequest, ...@@ -40,6 +39,8 @@ class ProfileDownloader : public ImageDecoder::ImageRequest,
}; };
explicit ProfileDownloader(ProfileDownloaderDelegate* delegate); explicit ProfileDownloader(ProfileDownloaderDelegate* delegate);
ProfileDownloader(const ProfileDownloader&) = delete;
ProfileDownloader& operator=(const ProfileDownloader&) = delete;
~ProfileDownloader() override; ~ProfileDownloader() override;
// Starts downloading profile information if the necessary authorization token // Starts downloading profile information if the necessary authorization token
...@@ -122,13 +123,11 @@ class ProfileDownloader : public ImageDecoder::ImageRequest, ...@@ -122,13 +123,11 @@ class ProfileDownloader : public ImageDecoder::ImageRequest,
std::unique_ptr<signin::AccessTokenFetcher> oauth2_access_token_fetcher_; std::unique_ptr<signin::AccessTokenFetcher> oauth2_access_token_fetcher_;
AccountInfo account_info_; AccountInfo account_info_;
SkBitmap profile_picture_; SkBitmap profile_picture_;
PictureStatus picture_status_; PictureStatus picture_status_ = PICTURE_FAILED;
signin::IdentityManager* identity_manager_; signin::IdentityManager* identity_manager_;
ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer> ScopedObserver<signin::IdentityManager, signin::IdentityManager::Observer>
identity_manager_observer_; identity_manager_observer_;
bool waiting_for_account_info_; bool waiting_for_account_info_ = false;
DISALLOW_COPY_AND_ASSIGN(ProfileDownloader);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_DOWNLOADER_H_
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_OBSERVER_H_ #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_OBSERVER_H_
#define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_OBSERVER_H_ #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_OBSERVER_H_
#include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
...@@ -17,7 +16,9 @@ class FilePath; ...@@ -17,7 +16,9 @@ class FilePath;
// ProfileInfoCache. // ProfileInfoCache.
class ProfileInfoCacheObserver { class ProfileInfoCacheObserver {
public: public:
virtual ~ProfileInfoCacheObserver() {} ProfileInfoCacheObserver(const ProfileInfoCacheObserver&) = delete;
ProfileInfoCacheObserver& operator=(const ProfileInfoCacheObserver&) = delete;
virtual ~ProfileInfoCacheObserver() = default;
virtual void OnProfileAdded(const base::FilePath& profile_path) {} virtual void OnProfileAdded(const base::FilePath& profile_path) {}
virtual void OnProfileWillBeRemoved(const base::FilePath& profile_path) {} virtual void OnProfileWillBeRemoved(const base::FilePath& profile_path) {}
...@@ -37,9 +38,7 @@ class ProfileInfoCacheObserver { ...@@ -37,9 +38,7 @@ class ProfileInfoCacheObserver {
const base::FilePath& profile_path) {} const base::FilePath& profile_path) {}
protected: protected:
ProfileInfoCacheObserver() {} ProfileInfoCacheObserver() = default;
DISALLOW_COPY_AND_ASSIGN(ProfileInfoCacheObserver);
}; };
#endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_OBSERVER_H_ #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_OBSERVER_H_
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdint.h> #include <stdint.h>
#include <algorithm> #include <algorithm>
#include <set>
#include <vector> #include <vector>
#include "base/bind.h" #include "base/bind.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <set> #include <set>
#include "base/macros.h"
#include "chrome/browser/profiles/profile_info_cache_observer.h" #include "chrome/browser/profiles/profile_info_cache_observer.h"
#include "chrome/test/base/testing_profile_manager.h" #include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
...@@ -25,6 +24,9 @@ class ProfileNameVerifierObserver : public ProfileInfoCacheObserver { ...@@ -25,6 +24,9 @@ class ProfileNameVerifierObserver : public ProfileInfoCacheObserver {
public: public:
explicit ProfileNameVerifierObserver( explicit ProfileNameVerifierObserver(
TestingProfileManager* testing_profile_manager); TestingProfileManager* testing_profile_manager);
ProfileNameVerifierObserver(const ProfileNameVerifierObserver&) = delete;
ProfileNameVerifierObserver& operator=(const ProfileNameVerifierObserver&) =
delete;
~ProfileNameVerifierObserver() override; ~ProfileNameVerifierObserver() override;
// ProfileInfoCacheObserver overrides: // ProfileInfoCacheObserver overrides:
...@@ -40,7 +42,6 @@ class ProfileNameVerifierObserver : public ProfileInfoCacheObserver { ...@@ -40,7 +42,6 @@ class ProfileNameVerifierObserver : public ProfileInfoCacheObserver {
ProfileInfoCache* GetCache(); ProfileInfoCache* GetCache();
std::map<base::FilePath, base::string16> profile_names_; std::map<base::FilePath, base::string16> profile_names_;
TestingProfileManager* testing_profile_manager_; TestingProfileManager* testing_profile_manager_;
DISALLOW_COPY_AND_ASSIGN(ProfileNameVerifierObserver);
}; };
class ProfileInfoCacheTest : public testing::Test { class ProfileInfoCacheTest : public testing::Test {
......
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