Skip to content

Commit

Permalink
Revert "Update all users of base::Version to explicitly specify the n…
Browse files Browse the repository at this point in the history
…amespace, and clean up the header."

This is a speculative revert of r242414.

BUG=330681
TEST=as in bug
TBR=ben@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242889 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
avi@chromium.org committed Jan 3, 2014
1 parent 3bc2e37 commit c5e4a22
Show file tree
Hide file tree
Showing 114 changed files with 424 additions and 426 deletions.
4 changes: 4 additions & 0 deletions base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@ 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_
2 changes: 0 additions & 2 deletions base/version_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

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

using base::Version;

namespace {

TEST(VersionTest, DefaultConstructor) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/app/chrome_breakpad_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool ChromeBreakpadClient::AboutToRestart() {

bool ChromeBreakpadClient::GetDeferredUploadsSupported(
bool is_per_user_install) {
base::Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion(
Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion(
!is_per_user_install);
if (!update_version.IsValid() ||
update_version.IsOlderThan(std::string(kMinUpdateVersion)))
Expand Down
4 changes: 2 additions & 2 deletions chrome/app/client_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ base::string16 GetCurrentModuleVersion() {
FileVersionInfo::CreateFileVersionInfoForCurrentModule());
if (file_version_info.get()) {
base::string16 version_string(file_version_info->file_version());
if (base::Version(WideToASCII(version_string)).IsValid())
if (Version(WideToASCII(version_string)).IsValid())
return version_string;
}
return base::string16();
Expand Down Expand Up @@ -238,7 +238,7 @@ HMODULE MainDllLoader::Load(base::string16* out_version,
// This is used to support Chrome Frame, see http://crbug.com/88589.
version_string = cmd_line.GetSwitchValueNative(switches::kChromeVersion);

if (!base::Version(WideToASCII(version_string)).IsValid()) {
if (!Version(WideToASCII(version_string)).IsValid()) {
// If a bogus command line flag was given, then abort.
LOG(ERROR) << "Invalid command line version: " << version_string;
return NULL;
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 @@ -356,7 +356,7 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() {
// TODO(tommi): Check if using the default distribution is always the right
// thing to do.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::Version version;
Version version;
InstallUtil::GetChromeVersion(dist, true, &version);
if (version.IsValid()) {
base::FilePath exe_path;
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/chromeos/extensions/external_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void ExternalCache::BackendCheckCacheContentsInternal(
id.clear();
}

if (!base::Version(version).IsValid()) {
if (!Version(version).IsValid()) {
LOG(ERROR) << "Bad extension version in ExternalCache: " << version;
version.clear();
}
Expand Down Expand Up @@ -376,8 +376,8 @@ void ExternalCache::BackendCheckCacheContentsInternal(
&prev_version_string) &&
entry->GetString(extensions::ExternalProviderImpl::kExternalCrx,
&prev_crx)) {
base::Version prev_version(prev_version_string);
base::Version curr_version(version);
Version prev_version(prev_version_string);
Version curr_version(version);
DCHECK(prev_version.IsValid());
DCHECK(curr_version.IsValid());
if (prev_version.CompareTo(curr_version) <= 0) {
Expand Down Expand Up @@ -472,7 +472,7 @@ void ExternalCache::BackendInstallCacheEntry(
const std::string& id,
const base::FilePath& path,
const std::string& version) {
base::Version version_validator(version);
Version version_validator(version);
if (!version_validator.IsValid()) {
LOG(ERROR) << "ExternalCache downloaded extension " << id << " but got bad "
<< "version: " << version;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/chromeos/login/existing_user_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "base/version.h"
#include "chrome/browser/accessibility/accessibility_events.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/component_updater/component_updater_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ static std::string HexStringToID(const std::string& hexstr) {
}

// Returns true if the |proposed| version is newer than |current| version.
bool IsVersionNewer(const base::Version& current, const std::string& proposed) {
base::Version proposed_ver(proposed);
bool IsVersionNewer(const Version& current, const std::string& proposed) {
Version proposed_ver(proposed);
return proposed_ver.IsValid() && current.CompareTo(proposed_ver) < 0;
}

Expand Down Expand Up @@ -329,7 +329,7 @@ class CrxUpdateService : public ComponentUpdateService {

scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;

const base::Version chrome_version_;
const Version chrome_version_;

bool running_;

Expand Down Expand Up @@ -738,7 +738,7 @@ void CrxUpdateService::AddItemToUpdateCheck(CrxUpdateItem* item,
item->crx_urls.clear();
item->crx_diffurls.clear();
item->previous_version = item->component.version;
item->next_version = base::Version();
item->next_version = Version();
item->previous_fp = item->component.fingerprint;
item->next_fp.clear();
item->diff_update_failed = false;
Expand Down Expand Up @@ -849,7 +849,7 @@ void CrxUpdateService::OnParseUpdateResponseSucceeded(
}

// Parse the members of the result and queue an upgrade for this component.
crx->next_version = base::Version(it->manifest.version);
crx->next_version = Version(it->manifest.version);

typedef component_updater::
UpdateResponse::Result::Manifest::Package Package;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct CrxComponent {
std::vector<uint8> pk_hash;
ComponentInstaller* installer;
ComponentObserver* observer;
base::Version version;
Version version;
std::string fingerprint;
std::string name;
CrxComponent();
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/component_updater/crx_update_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ struct CrxUpdateItem {
std::vector<GURL> crx_diffurls;

// The from/to version and fingerprint values.
base::Version previous_version;
base::Version next_version;
Version previous_version;
Version next_version;
std::string previous_fp;
std::string next_fp;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ base::FilePath GetPepperFlashBaseDirectory() {
// |latest_version| returns the corresponding version number. |older_dirs|
// returns directories of all older versions.
bool GetPepperFlashDirectory(base::FilePath* latest_dir,
base::Version* latest_version,
Version* latest_version,
std::vector<base::FilePath>* older_dirs) {
base::FilePath base_dir = GetPepperFlashBaseDirectory();
bool found = false;
base::FileEnumerator
file_enumerator(base_dir, false, base::FileEnumerator::DIRECTORIES);
for (base::FilePath path = file_enumerator.Next(); !path.value().empty();
path = file_enumerator.Next()) {
base::Version version(path.BaseName().MaybeAsASCII());
Version version(path.BaseName().MaybeAsASCII());
if (!version.IsValid())
continue;
if (found) {
Expand Down Expand Up @@ -138,7 +138,7 @@ bool SupportsPepperInterface(const char* interface_name) {
}

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

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

// Do it only if the version we're trying to register is newer.
base::Version registered_version(base::UTF16ToUTF8(it->version));
Version registered_version(base::UTF16ToUTF8(it->version));
if (registered_version.IsValid() &&
version.CompareTo(registered_version) <= 0) {
return;
Expand Down Expand Up @@ -245,7 +245,7 @@ bool CheckPepperFlashInterfaces(const base::DictionaryValue& manifest) {

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

virtual ~PepperFlashComponentInstaller() {}

Expand All @@ -258,11 +258,11 @@ class PepperFlashComponentInstaller : public ComponentInstaller {
base::FilePath* installed_file) OVERRIDE;

private:
base::Version current_version_;
Version current_version_;
};

PepperFlashComponentInstaller::PepperFlashComponentInstaller(
const base::Version& version) : current_version_(version) {
const Version& version) : current_version_(version) {
DCHECK(version.IsValid());
}

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

bool CheckPepperFlashManifest(const base::DictionaryValue& manifest,
base::Version* version_out) {
Version* version_out) {
std::string name;
manifest.GetStringASCII("name", &name);
// TODO(viettrungluu): Support WinFlapper for now, while we change the format
Expand All @@ -316,7 +316,7 @@ bool CheckPepperFlashManifest(const base::DictionaryValue& manifest,

std::string proposed_version;
manifest.GetStringASCII("version", &proposed_version);
base::Version version(proposed_version.c_str());
Version version(proposed_version.c_str());
if (!version.IsValid())
return false;

Expand Down Expand Up @@ -347,7 +347,7 @@ namespace {

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

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

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

bool GetLatestPnaclDirectory(PnaclComponentInstaller* pci,
base::FilePath* latest_dir,
base::Version* latest_version,
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 @@ -99,7 +99,7 @@ bool GetLatestPnaclDirectory(PnaclComponentInstaller* pci,
file_enumerator(base_dir, false, base::FileEnumerator::DIRECTORIES);
for (base::FilePath path = file_enumerator.Next(); !path.value().empty();
path = file_enumerator.Next()) {
base::Version version(path.BaseName().MaybeAsASCII());
Version version(path.BaseName().MaybeAsASCII());
if (!version.IsValid())
continue;
if (found) {
Expand Down Expand Up @@ -155,7 +155,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,
base::Version* version_out) {
Version* version_out) {
// Make sure we have the right |manifest| file.
std::string name;
if (!manifest.GetStringASCII("name", &name)) {
Expand All @@ -177,7 +177,7 @@ bool CheckPnaclComponentManifest(const base::DictionaryValue& manifest,
LOG(WARNING) << "'version' field is missing from manifest!";
return false;
}
base::Version version(proposed_version.c_str());
Version version(proposed_version.c_str());
if (!version.IsValid()) {
LOG(WARNING) << "'version' field in manifest is invalid "
<< version.GetString();
Expand Down Expand Up @@ -259,7 +259,7 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest,
return false;
}

base::Version version;
Version version;
if (!CheckPnaclComponentManifest(manifest, *pnacl_manifest, &version)) {
LOG(WARNING) << "CheckPnaclComponentManifest failed, not installing.";
return false;
Expand Down Expand Up @@ -297,7 +297,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(base::Version(kNullVersion)))
if (current_version().Equals(Version(kNullVersion)))
return false;

*installed_file = GetPnaclBaseDirectory().AppendASCII(
Expand All @@ -318,7 +318,7 @@ CrxComponent PnaclComponentInstaller::GetCrxComponent() {

namespace {

void FinishPnaclUpdateRegistration(const base::Version& current_version,
void FinishPnaclUpdateRegistration(const Version& current_version,
const std::string& current_fingerprint,
PnaclComponentInstaller* pci) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
Expand Down Expand Up @@ -347,15 +347,15 @@ void StartPnaclUpdateRegistration(PnaclComponentInstaller* pci) {
}
}

base::Version current_version(kNullVersion);
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));
base::Version manifest_version;
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 @@ -364,7 +364,7 @@ void StartPnaclUpdateRegistration(PnaclComponentInstaller* pci) {
*pnacl_manifest,
&manifest_version)
|| !current_version.Equals(manifest_version)) {
current_version = base::Version(kNullVersion);
current_version = Version(kNullVersion);
} else {
OverrideDirPnaclComponent(path);
base::ReadFileToString(path.AppendASCII("manifest.fingerprint"),
Expand Down
Loading

0 comments on commit c5e4a22

Please sign in to comment.