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