Skip to content

Commit

Permalink
base: Remove using:: declaration from version.h header.
Browse files Browse the repository at this point in the history
BUG=None
R=brettw@chromium.org

Review URL: https://codereview.chromium.org/1281313003

Cr-Commit-Position: refs/heads/master@{#344088}
  • Loading branch information
tfarina authored and Commit bot committed Aug 19, 2015
1 parent 6eb8e3d commit 9c2f5dc
Show file tree
Hide file tree
Showing 104 changed files with 393 additions and 388 deletions.
5 changes: 0 additions & 5 deletions base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <vector>

#include "base/base_export.h"
#include "base/basictypes.h"

namespace base {

Expand Down Expand Up @@ -66,8 +65,4 @@ class BASE_EXPORT Version {

} // namespace base

// TODO(xhwang) remove this when all users are updated to explicitly use the
// namespace
using base::Version;

#endif // BASE_VERSION_H_
3 changes: 3 additions & 0 deletions base/version_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

#include "base/version.h"

#include "base/macros.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace {

TEST(VersionTest, DefaultConstructor) {
Expand Down Expand Up @@ -152,3 +154,4 @@ TEST(VersionTest, IsValidWildcardString) {
}

} // namespace
} // namespace base
2 changes: 1 addition & 1 deletion chrome/app/chrome_crash_reporter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool ChromeCrashReporterClient::AboutToRestart() {

bool ChromeCrashReporterClient::GetDeferredUploadsSupported(
bool is_per_user_install) {
Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion(
base::Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion(
!is_per_user_install);
if (!update_version.IsValid() ||
update_version.IsOlderThan(std::string(kMinUpdateVersion)))
Expand Down
2 changes: 1 addition & 1 deletion chrome/app/client_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ base::string16 GetCurrentModuleVersion() {
FileVersionInfo::CreateFileVersionInfoForCurrentModule());
if (file_version_info.get()) {
base::string16 version_string(file_version_info->file_version());
if (Version(base::UTF16ToASCII(version_string)).IsValid())
if (base::Version(base::UTF16ToASCII(version_string)).IsValid())
return version_string;
}
return base::string16();
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chrome_browser_main_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() {
// TODO(tommi): Check if using the default distribution is always the right
// thing to do.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
Version version;
base::Version version;
InstallUtil::GetChromeVersion(dist, true, &version);
if (version.IsValid()) {
base::FilePath exe_path;
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/login/kiosk_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ class KioskTest : public OobeBaseTest {
extension_service()->GetInstalledExtension(test_app_id_);
}

const Version& GetInstalledAppVersion() {
const base::Version& GetInstalledAppVersion() {
return *GetInstalledApp()->version();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ TEST(ComponentInstallerTest, PepperFlashCheck) {
ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY));

// This checks that the whole manifest is compatible.
Version version;
base::Version version;
EXPECT_TRUE(chrome::CheckPepperFlashManifest(*root, &version));
EXPECT_TRUE(version.IsValid());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void DoInitialLoadFromDisk(const base::FilePath& stored_whitelist_path) {
// which will have a valid version.
scoped_refptr<net::ct::EVCertsWhitelist> new_whitelist(
new packed_ct_ev_whitelist::PackedEVCertsWhitelist(compressed_list,
Version()));
base::Version()));
if (!new_whitelist->IsValid()) {
VLOG(1) << "Failed uncompressing EV certs whitelist.";
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const char kNullVersion[] = "0.0.0.0";
// |latest_version| returns the corresponding version number. |older_dirs|
// returns directories of all older versions.
bool GetPepperFlashDirectory(base::FilePath* latest_dir,
Version* latest_version,
base::Version* latest_version,
std::vector<base::FilePath>* older_dirs) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
base::FilePath base_dir;
Expand All @@ -79,7 +79,7 @@ bool GetPepperFlashDirectory(base::FilePath* latest_dir,
base_dir, false, base::FileEnumerator::DIRECTORIES);
for (base::FilePath path = file_enumerator.Next(); !path.value().empty();
path = file_enumerator.Next()) {
Version version(path.BaseName().MaybeAsASCII());
base::Version version(path.BaseName().MaybeAsASCII());
if (!version.IsValid())
continue;
if (found) {
Expand All @@ -102,7 +102,7 @@ bool GetPepperFlashDirectory(base::FilePath* latest_dir,

#if !defined(OS_LINUX) || defined(GOOGLE_CHROME_BUILD)
bool MakePepperFlashPluginInfo(const base::FilePath& flash_path,
const Version& flash_version,
const base::Version& flash_version,
bool out_of_process,
content::PepperPluginInfo* plugin_info) {
if (!flash_version.IsValid())
Expand Down Expand Up @@ -146,7 +146,7 @@ bool IsPepperFlash(const content::WebPluginInfo& plugin) {
}

void RegisterPepperFlashWithChrome(const base::FilePath& path,
const Version& version) {
const base::Version& version) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::PepperPluginInfo plugin_info;
if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
Expand All @@ -162,7 +162,7 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
continue;

// Do it only if the version we're trying to register is newer.
Version registered_version(base::UTF16ToUTF8(it->version));
base::Version registered_version(base::UTF16ToUTF8(it->version));
if (registered_version.IsValid() &&
version.CompareTo(registered_version) <= 0) {
return;
Expand All @@ -183,7 +183,7 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,

class PepperFlashComponentInstaller : public update_client::CrxInstaller {
public:
explicit PepperFlashComponentInstaller(const Version& version);
explicit PepperFlashComponentInstaller(const base::Version& version);

// ComponentInstaller implementation:
void OnUpdateError(int error) override;
Expand All @@ -199,11 +199,11 @@ class PepperFlashComponentInstaller : public update_client::CrxInstaller {
private:
~PepperFlashComponentInstaller() override {}

Version current_version_;
base::Version current_version_;
};

PepperFlashComponentInstaller::PepperFlashComponentInstaller(
const Version& version)
const base::Version& version)
: current_version_(version) {
DCHECK(version.IsValid());
}
Expand All @@ -215,7 +215,7 @@ void PepperFlashComponentInstaller::OnUpdateError(int error) {
bool PepperFlashComponentInstaller::Install(
const base::DictionaryValue& manifest,
const base::FilePath& unpack_path) {
Version version;
base::Version version;
if (!chrome::CheckPepperFlashManifest(manifest, &version))
return false;
if (current_version_.CompareTo(version) > 0)
Expand Down Expand Up @@ -279,7 +279,7 @@ namespace {

#if defined(GOOGLE_CHROME_BUILD)
void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus,
const Version& version) {
const base::Version& version) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
update_client::CrxComponent pepflash;
pepflash.name = "pepper_flash";
Expand All @@ -305,7 +305,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
}
}

Version version(kNullVersion);
base::Version version(kNullVersion);
std::vector<base::FilePath> older_dirs;
if (GetPepperFlashDirectory(&path, &version, &older_dirs)) {
path = path.Append(chrome::kPepperFlashPluginFilename);
Expand All @@ -315,7 +315,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
FROM_HERE,
base::Bind(&RegisterPepperFlashWithChrome, path, version));
} else {
version = Version(kNullVersion);
version = base::Version(kNullVersion);
}
}

Expand All @@ -324,7 +324,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
// than the version of the component, or the component has never been updated,
// then set the bundled version as the current version.
if (version.CompareTo(Version(FLAPPER_VERSION_STRING)) < 0)
version = Version(FLAPPER_VERSION_STRING);
version = base::Version(FLAPPER_VERSION_STRING);
#endif

BrowserThread::PostTask(
Expand Down
20 changes: 10 additions & 10 deletions chrome/browser/component_updater/pnacl_component_installer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void OverrideDirPnaclComponent(const base::FilePath& base_path) {

bool GetLatestPnaclDirectory(const scoped_refptr<PnaclComponentInstaller>& pci,
base::FilePath* latest_dir,
Version* latest_version,
base::Version* latest_version,
std::vector<base::FilePath>* older_dirs) {
// Enumerate all versions starting from the base directory.
base::FilePath base_dir = pci->GetPnaclBaseDirectory();
Expand All @@ -103,7 +103,7 @@ bool GetLatestPnaclDirectory(const scoped_refptr<PnaclComponentInstaller>& pci,
base_dir, false, base::FileEnumerator::DIRECTORIES);
for (base::FilePath path = file_enumerator.Next(); !path.value().empty();
path = file_enumerator.Next()) {
Version version(path.BaseName().MaybeAsASCII());
base::Version version(path.BaseName().MaybeAsASCII());
if (!version.IsValid())
continue;
if (found) {
Expand Down Expand Up @@ -158,7 +158,7 @@ base::DictionaryValue* ReadComponentManifest(
// PNaCl manifest indicates this is the correct arch-specific package.
bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest,
const base::DictionaryValue& pnacl_manifest,
Version* version_out) {
base::Version* version_out) {
// Make sure we have the right |manifest| file.
std::string name;
if (!manifest.GetStringASCII("name", &name)) {
Expand All @@ -179,7 +179,7 @@ bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest,
LOG(WARNING) << "'version' field is missing from manifest!";
return false;
}
Version version(proposed_version.c_str());
base::Version version(proposed_version.c_str());
if (!version.IsValid()) {
LOG(WARNING) << "'version' field in manifest is invalid "
<< version.GetString();
Expand Down Expand Up @@ -233,7 +233,7 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
return false;
}

Version version;
base::Version version;
if (!CheckPnaclComponentManifest(manifest, *pnacl_manifest, &version)) {
LOG(WARNING) << "CheckPnaclComponentManifest failed, not installing.";
return false;
Expand Down Expand Up @@ -271,7 +271,7 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
// |installed_file| actually exists.
bool PnaclComponentInstaller::GetInstalledFile(const std::string& file,
base::FilePath* installed_file) {
if (current_version().Equals(Version(kNullVersion)))
if (current_version().Equals(base::Version(kNullVersion)))
return false;

*installed_file = GetPnaclBaseDirectory()
Expand All @@ -298,7 +298,7 @@ CrxComponent PnaclComponentInstaller::GetCrxComponent() {
namespace {

void FinishPnaclUpdateRegistration(
const Version& current_version,
const base::Version& current_version,
const std::string& current_fingerprint,
const scoped_refptr<PnaclComponentInstaller>& pci) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Expand All @@ -324,13 +324,13 @@ void StartPnaclUpdateRegistration(
}
}

Version current_version(kNullVersion);
base::Version current_version(kNullVersion);
std::string current_fingerprint;
std::vector<base::FilePath> older_dirs;
if (GetLatestPnaclDirectory(pci, &path, &current_version, &older_dirs)) {
scoped_ptr<base::DictionaryValue> manifest(ReadComponentManifest(path));
scoped_ptr<base::DictionaryValue> pnacl_manifest(ReadPnaclManifest(path));
Version manifest_version;
base::Version manifest_version;
// Check that the component manifest and PNaCl manifest files
// are legit, and that the indicated version matches the one
// encoded within the path name.
Expand All @@ -339,7 +339,7 @@ void StartPnaclUpdateRegistration(
*pnacl_manifest,
&manifest_version) ||
!current_version.Equals(manifest_version)) {
current_version = Version(kNullVersion);
current_version = base::Version(kNullVersion);
} else {
OverrideDirPnaclComponent(path);
base::ReadFileToString(path.AppendASCII("manifest.fingerprint"),
Expand Down
20 changes: 11 additions & 9 deletions chrome/browser/component_updater/recovery_component_installer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ base::CommandLine GetRecoveryInstallCommandLine(
const base::FilePath& command,
const base::DictionaryValue& manifest,
bool is_deferred_run,
const Version& version) {
const base::Version& version) {
base::CommandLine command_line(command);

// Add a flag to for re-attempted install with elevated privilege so that the
Expand Down Expand Up @@ -154,7 +154,7 @@ void DoElevatedInstallRecoveryComponent(const base::FilePath& path) {
return;
std::string proposed_version;
manifest->GetStringASCII("version", &proposed_version);
const Version version(proposed_version.c_str());
const base::Version version(proposed_version.c_str());
if (!version.IsValid())
return;

Expand Down Expand Up @@ -195,7 +195,7 @@ void ElevatedInstallRecoveryComponent(const base::FilePath& installer_path) {
// See chrome/browser/recovery/recovery_install_global_error.cc for details.
class RecoveryComponentInstaller : public update_client::CrxInstaller {
public:
RecoveryComponentInstaller(const Version& version, PrefService* prefs);
RecoveryComponentInstaller(const base::Version& version, PrefService* prefs);

// ComponentInstaller implementation:
void OnUpdateError(int error) override;
Expand All @@ -214,7 +214,7 @@ class RecoveryComponentInstaller : public update_client::CrxInstaller {
bool RunInstallCommand(const base::CommandLine& cmdline,
const base::FilePath& installer_folder) const;

Version current_version_;
base::Version current_version_;
PrefService* prefs_;
};

Expand All @@ -224,7 +224,7 @@ void SimulateElevatedRecoveryHelper(PrefService* prefs) {

void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
base::Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
if (!version.IsValid()) {
NOTREACHED();
return;
Expand All @@ -240,7 +240,8 @@ void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) {
}
}

void RecoveryUpdateVersionHelper(const Version& version, PrefService* prefs) {
void RecoveryUpdateVersionHelper(const base::Version& version,
PrefService* prefs) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
prefs->SetString(prefs::kRecoveryComponentVersion, version.GetString());
}
Expand All @@ -252,8 +253,9 @@ void SetPrefsForElevatedRecoveryInstall(const base::FilePath& unpack_path,
prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, true);
}

RecoveryComponentInstaller::RecoveryComponentInstaller(const Version& version,
PrefService* prefs)
RecoveryComponentInstaller::RecoveryComponentInstaller(
const base::Version& version,
PrefService* prefs)
: current_version_(version), prefs_(prefs) {
DCHECK(version.IsValid());
}
Expand Down Expand Up @@ -328,7 +330,7 @@ bool RecoveryComponentInstaller::Install(const base::DictionaryValue& manifest,
return false;
std::string proposed_version;
manifest.GetStringASCII("version", &proposed_version);
Version version(proposed_version.c_str());
base::Version version(proposed_version.c_str());
if (!version.IsValid())
return false;
if (current_version_.CompareTo(version) >= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class SwReporterInstallerTraits : public ComponentInstallerTraits {

static std::string ID() {
update_client::CrxComponent component;
component.version = Version("0.0.0.0");
component.version = base::Version("0.0.0.0");
GetPkHash(&component.pk_hash);
return update_client::GetCrxComponentID(component);
}
Expand Down
Loading

0 comments on commit 9c2f5dc

Please sign in to comment.