chrome: change ProfileErrorType enum into an enum class

See http://www.stroustrup.com/C++11FAQ.html#enum to see why enum class
is preferred over traditional enums.

BUG=621555
[email protected]

Review-Url: https://chromiumcodereview.appspot.com/2438433006
Cr-Commit-Position: refs/heads/master@{#426682}
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 19814e2..f090198e 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -583,9 +583,9 @@
     profile = GetFallbackStartupProfile();
 
   if (!profile) {
-    ProfileErrorType error_type = profile_dir_specified ?
-                                  PROFILE_ERROR_CREATE_FAILURE_SPECIFIED :
-                                  PROFILE_ERROR_CREATE_FAILURE_ALL;
+    ProfileErrorType error_type =
+        profile_dir_specified ? ProfileErrorType::CREATE_FAILURE_SPECIFIED
+                              : ProfileErrorType::CREATE_FAILURE_ALL;
 
     // TODO(lwchkg): What diagnostics do you want to include in the feedback
     // report when an error occurs?
diff --git a/chrome/browser/history/chrome_history_client.cc b/chrome/browser/history/chrome_history_client.cc
index 25d3725b..427643b 100644
--- a/chrome/browser/history/chrome_history_client.cc
+++ b/chrome/browser/history/chrome_history_client.cc
@@ -64,7 +64,7 @@
 
 void ChromeHistoryClient::NotifyProfileError(sql::InitStatus init_status,
                                              const std::string& diagnostics) {
-  ShowProfileErrorDialog(PROFILE_ERROR_HISTORY,
+  ShowProfileErrorDialog(ProfileErrorType::HISTORY,
                          SqlInitStatusToMessageId(init_status), diagnostics);
 }
 
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index b8f36c9..b39186e 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -376,7 +376,7 @@
     if (message_id) {
       BrowserThread::PostTask(
           BrowserThread::UI, FROM_HERE,
-          base::Bind(&ShowProfileErrorDialog, PROFILE_ERROR_PREFERENCES,
+          base::Bind(&ShowProfileErrorDialog, ProfileErrorType::PREFERENCES,
                      message_id,
                      sql::GetCorruptFileDiagnosticsInfo(pref_filename)));
     }
diff --git a/chrome/browser/ui/profile_error_dialog.cc b/chrome/browser/ui/profile_error_dialog.cc
index 3db126d..a705b6f9 100644
--- a/chrome/browser/ui/profile_error_dialog.cc
+++ b/chrome/browser/ui/profile_error_dialog.cc
@@ -28,7 +28,8 @@
 #if defined(OS_ANDROID)
   NOTIMPLEMENTED();
 #else
-  UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END);
+  UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", static_cast<int>(type),
+                            static_cast<int>(ProfileErrorType::END));
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kNoErrorDialogs)) {
     return;
diff --git a/chrome/browser/ui/profile_error_dialog.h b/chrome/browser/ui/profile_error_dialog.h
index a3d325f..0c552a7 100644
--- a/chrome/browser/ui/profile_error_dialog.h
+++ b/chrome/browser/ui/profile_error_dialog.h
@@ -8,21 +8,20 @@
 #include <string>
 
 // Be very careful while modifying this enum. Do NOT remove any elements from
-// this enum. If you need to add one, add them to the end, right before
-// PROFILE_ERROR_END. PROFILE_ERROR_END should ALWAYS be the last element in
-// this enum. This is important because this enum is used to back a histogram,
-// and these are implicit assumptions made in terms of how enumerated
-// histograms are defined.
-enum ProfileErrorType {
-  PROFILE_ERROR_HISTORY,
-  PROFILE_ERROR_PREFERENCES,
-  PROFILE_ERROR_DB_AUTOFILL_WEB_DATA,
-  PROFILE_ERROR_DB_TOKEN_WEB_DATA,
-  PROFILE_ERROR_DB_WEB_DATA,
-  PROFILE_ERROR_DB_KEYWORD_WEB_DATA,
-  PROFILE_ERROR_CREATE_FAILURE_SPECIFIED,
-  PROFILE_ERROR_CREATE_FAILURE_ALL,
-  PROFILE_ERROR_END
+// this enum. If you need to add one, add them to the end, right before END.
+// END should ALWAYS be the last element in this enum. This is important because
+// this enum is used to back a histogram, and these are implicit assumptions
+// made in terms of how enumerated histograms are defined.
+enum class ProfileErrorType {
+  HISTORY,
+  PREFERENCES,
+  DB_AUTOFILL_WEB_DATA,
+  DB_TOKEN_WEB_DATA,
+  DB_WEB_DATA,
+  DB_KEYWORD_WEB_DATA,
+  CREATE_FAILURE_SPECIFIED,
+  CREATE_FAILURE_ALL,
+  END
 };
 
 // Shows an error dialog corresponding to the inability to open some portion of
diff --git a/chrome/browser/web_data_service_factory.cc b/chrome/browser/web_data_service_factory.cc
index 638eae6..258de38 100644
--- a/chrome/browser/web_data_service_factory.cc
+++ b/chrome/browser/web_data_service_factory.cc
@@ -34,21 +34,21 @@
     WebDataServiceWrapper::ErrorType error_type) {
   switch (error_type) {
     case WebDataServiceWrapper::ERROR_LOADING_AUTOFILL:
-      return PROFILE_ERROR_DB_AUTOFILL_WEB_DATA;
+      return ProfileErrorType::DB_AUTOFILL_WEB_DATA;
 
     case WebDataServiceWrapper::ERROR_LOADING_KEYWORD:
-      return PROFILE_ERROR_DB_KEYWORD_WEB_DATA;
+      return ProfileErrorType::DB_KEYWORD_WEB_DATA;
 
     case WebDataServiceWrapper::ERROR_LOADING_TOKEN:
-      return PROFILE_ERROR_DB_TOKEN_WEB_DATA;
+      return ProfileErrorType::DB_TOKEN_WEB_DATA;
 
     case WebDataServiceWrapper::ERROR_LOADING_PASSWORD:
-      return PROFILE_ERROR_DB_WEB_DATA;
+      return ProfileErrorType::DB_WEB_DATA;
 
     default:
       NOTREACHED()
           << "Unknown WebDataServiceWrapper::ErrorType: " << error_type;
-      return PROFILE_ERROR_DB_WEB_DATA;
+      return ProfileErrorType::DB_WEB_DATA;
   }
 }