Renamed enums to avoid conflicts with Win32 macro names.
Before the changes, file_change.h did not compile on Windows, because
some enum names defined in file_change.h were already taken by macro
definitions from Win32 API. I guess the pre-processor doesn't know
about C++ namespaces / classes / enums... :-/
Conflict 1: FILE_TYPE_UNKNOWN. This name is taken by a macro definition
from Win32 API:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364960%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
FILE_TYPE_UNKNOWN 0x0000
Conflict 2: DELETE. I have not been able to track down the exact source
of the macro definition in this case. At the same time:
- I am pretty sure that compilation problems are also caused by a
conflicting macro definition name (i.e. compilation problems also go
away if I ask the preprocessor to undefine DELETE, before defining the
enums).
- Prepending the name of the enum to the name of the enum value seems to
be pretty common elsewhere (i.e. FileType enum uses FILE_TYPE_DIRECTORY,
rather than DIRECTORY name for one of its values).
The changes fix the conflict by renaming the enum names:
- FileType enum:
- FILE_TYPE_UNKNOWN -> FILE_TYPE_NO_INFO
- ChangeType enum:
- DELETE -> CHANGE_TYPE_DELETE
- ADD_OR_UPDATE -> CHANGE_TYPE_ADD_OR_UPDATE (for consistency)
BUG=498951
TEST=built (GYP_DEFINES included chromeos=1) and run unit_tests gyp/ninja target from chrome/chrome_tests_unit.gypi
Review URL: https://codereview.chromium.org/1180053004
Cr-Commit-Position: refs/heads/master@{#334202}
diff --git a/chrome/browser/chromeos/drive/file_change.h b/chrome/browser/chromeos/drive/file_change.h
index 1314c7e..a8c29ffb 100644
--- a/chrome/browser/chromeos/drive/file_change.h
+++ b/chrome/browser/chromeos/drive/file_change.h
@@ -19,22 +19,22 @@
class FileChange {
public:
enum FileType {
- FILE_TYPE_UNKNOWN,
+ FILE_TYPE_NO_INFO,
FILE_TYPE_FILE,
FILE_TYPE_DIRECTORY,
};
enum ChangeType {
- ADD_OR_UPDATE,
- DELETE,
+ CHANGE_TYPE_ADD_OR_UPDATE,
+ CHANGE_TYPE_DELETE,
};
class Change {
public:
Change(ChangeType change, FileType file_type);
- bool IsAddOrUpdate() const { return change_ == ADD_OR_UPDATE; }
- bool IsDelete() const { return change_ == DELETE; }
+ bool IsAddOrUpdate() const { return change_ == CHANGE_TYPE_ADD_OR_UPDATE; }
+ bool IsDelete() const { return change_ == CHANGE_TYPE_DELETE; }
bool IsFile() const { return file_type_ == FILE_TYPE_FILE; }
bool IsDirectory() const { return file_type_ == FILE_TYPE_DIRECTORY; }