NavigationAction constructor cleanup.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 May 2015 22:01:21 +0000 (22:01 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 May 2015 22:01:21 +0000 (22:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145472

Reviewed by Alex Christensen.

No new tests (Refactor, no change in behavior).

* loader/NavigationAction.cpp:
(WebCore::NavigationAction::NavigationAction): Delegate many of the various constructors
  to a single full-featured constructor.
* loader/NavigationAction.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185007 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/loader/NavigationAction.cpp
Source/WebCore/loader/NavigationAction.h

index e8ca2e6..4e4ca4f 100644 (file)
@@ -1,3 +1,17 @@
+2015-05-29  Brady Eidson  <beidson@apple.com>
+
+        NavigationAction constructor cleanup.
+        https://bugs.webkit.org/show_bug.cgi?id=145472
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Refactor, no change in behavior).
+
+        * loader/NavigationAction.cpp:
+        (WebCore::NavigationAction::NavigationAction): Delegate many of the various constructors
+          to a single full-featured constructor.
+        * loader/NavigationAction.h:
+
 2015-05-29  Matt Rajca  <mrajca@apple.com>
 
         Rename MediaSession and MediaSessionClient to PlatformMediaSession and PlatformMediaSessionClient so we can use MediaSession for the formal implementation of the Media Session spec.
index c77fbd0..6997759 100644 (file)
@@ -48,55 +48,47 @@ static NavigationType navigationType(FrameLoadType frameLoadType, bool isFormSub
     return NavigationType::Other;
 }
 
-NavigationAction::NavigationAction()
-    : m_type(NavigationType::Other)
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, PassRefPtr<Event> event, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
+    : m_resourceRequest(resourceRequest)
+    , m_type(type)
+    , m_event(event)
     , m_processingUserGesture(ScriptController::processingUserGesture())
+    , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
+{
+}
+
+NavigationAction::NavigationAction()
+    : NavigationAction(ResourceRequest(), NavigationType::Other, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
 {
 }
 
 NavigationAction::NavigationAction(const ResourceRequest& resourceRequest)
-    : m_resourceRequest(resourceRequest)
-    , m_type(NavigationType::Other)
-    , m_processingUserGesture(ScriptController::processingUserGesture())
+    : NavigationAction(resourceRequest, NavigationType::Other, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
 {
 }
 
 NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type)
-    : m_resourceRequest(resourceRequest)
-    , m_type(type)
-    , m_processingUserGesture(ScriptController::processingUserGesture())
+    : NavigationAction(resourceRequest, type, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
 {
 }
 
-NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType,
-        bool isFormSubmission)
-    : m_resourceRequest(resourceRequest)
-    , m_type(navigationType(frameLoadType, isFormSubmission, 0))
-    , m_processingUserGesture(ScriptController::processingUserGesture())
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType, bool isFormSubmission)
+    : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, 0), nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
 {
 }
 
 NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, PassRefPtr<Event> event)
-    : m_resourceRequest(resourceRequest)
-    , m_type(type)
-    , m_event(event)
-    , m_processingUserGesture(ScriptController::processingUserGesture())
+    : NavigationAction(resourceRequest, type, event, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
 {
 }
 
 NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
-    : m_resourceRequest(resourceRequest)
-    , m_type(type)
-    , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
+    : NavigationAction(resourceRequest, type, nullptr, shouldOpenExternalURLsPolicy)
 {
 }
 
-NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType,
-        bool isFormSubmission, PassRefPtr<Event> event)
-    : m_resourceRequest(resourceRequest)
-    , m_type(navigationType(frameLoadType, isFormSubmission, event))
-    , m_event(event)
-    , m_processingUserGesture(ScriptController::processingUserGesture())
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType, bool isFormSubmission, PassRefPtr<Event> event)
+    : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, event), event, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
 {
 }
 
index cfcccc3..de30899 100644 (file)
@@ -44,6 +44,7 @@ public:
     WEBCORE_EXPORT NavigationAction(const ResourceRequest&, NavigationType);
     WEBCORE_EXPORT NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission);
     NavigationAction(const ResourceRequest&, NavigationType, PassRefPtr<Event>);
+    NavigationAction(const ResourceRequest&, NavigationType, PassRefPtr<Event>, ShouldOpenExternalURLsPolicy);
     NavigationAction(const ResourceRequest&, NavigationType, ShouldOpenExternalURLsPolicy);
     NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, PassRefPtr<Event>);
 
@@ -65,7 +66,7 @@ private:
     NavigationType m_type;
     RefPtr<Event> m_event;
     bool m_processingUserGesture;
-    ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+    ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy;
 };
 
 }