:art:
authorKevin Sawicki <kevinsawicki@gmail.com>
Tue, 14 Jun 2016 17:05:25 +0000 (10:05 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 14 Jun 2016 22:47:33 +0000 (15:47 -0700)
atom/browser/api/atom_api_web_contents.cc

index 4f168c1cd03e91ffb3d979e32f2855cc352f978b..82c048d9a66ea8b6e6c0da0800b9d040af0cf652 100644 (file)
@@ -191,35 +191,28 @@ template<>
 struct Converter<atom::api::WebContents::Type> {
   static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
                                    atom::api::WebContents::Type val) {
+    using Type = atom::api::WebContents::Type;
     std::string type = "";
     switch (val) {
-      case atom::api::WebContents::Type::BACKGROUND_PAGE:
-        type = "backgroundPage";
-        break;
-      case atom::api::WebContents::Type::BROWSER_WINDOW:
-        type = "window";
-        break;
-      case atom::api::WebContents::Type::REMOTE:
-        type =  "remote";
-        break;
-      case atom::api::WebContents::Type::WEB_VIEW:
-        type = "webview";
-        break;
-      default:
-        break;
+      case Type::BACKGROUND_PAGE: type = "backgroundPage"; break;
+      case Type::BROWSER_WINDOW: type = "window"; break;
+      case Type::REMOTE: type = "remote"; break;
+      case Type::WEB_VIEW: type = "webview"; break;
+      default: break;
     }
     return mate::ConvertToV8(isolate, type);
   }
 
   static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
                      atom::api::WebContents::Type* out) {
+    using Type = atom::api::WebContents::Type;
     std::string type;
     if (!ConvertFromV8(isolate, val, &type))
       return false;
     if (type == "webview") {
-      *out = atom::api::WebContents::Type::WEB_VIEW;
+      *out = Type::WEB_VIEW;
     } else if (type == "backgroundPage") {
-      *out = atom::api::WebContents::Type::BACKGROUND_PAGE;
+      *out = Type::BACKGROUND_PAGE;
     } else {
       return false;
     }