      } else {
 -      // Otherwise create a new pending WebUI.
 -      pending_web_ui_ = delegate_->CreateWebUIForRenderFrameHost(dest_url);
-+	  //Give the frame a name if it does not already have one
-+	  //The reason is web ui code base the frame look up on the frame name
++      // Give the frame a name if it does not already have one.
++      // The reason is web ui code base the frame look up on the frame name.
 +      std::string frame_name = GetFrameName();
-+	  if (frame_name.empty() && !frame_tree_node_->IsMainFrame()) {
-+	      frame_name = base::StringPrintf("frame_%i", frame_tree_node_->frame_tree_node_id());
-+		  frame_tree_node_->SetFrameName(frame_name, "");
++      if (frame_name.empty() && !frame_tree_node_->IsMainFrame()) {
++        frame_name = base::StringPrintf("frame_%i", frame_tree_node_->frame_tree_node_id());
++        frame_tree_node_->SetFrameName(frame_name, "");
 +      }
 +
-+	  //if the web ui is in subframes, the parent frame bindings does not have the web ui binding
-+      //So, we reset the bindings for the subframes.
++      // If the web ui is in subframes, the parent frame bindings does not have the web ui binding,
++      // so we reset the bindings for the subframes.
 +      if (!frame_tree_node_->IsMainFrame() && new_web_ui_type != WebUI::kNoWebUI) {
-+	      entry_bindings = NavigationEntryImpl::kInvalidBindings;
-+	  }
-+		
-+	  // Otherwise create a new pending WebUI.
++        entry_bindings = NavigationEntryImpl::kInvalidBindings;
++      }
++
++      // Otherwise create a new pending WebUI.
 +      pending_web_ui_ = delegate_->CreateWebUIForRenderFrameHost(dest_url, frame_name);
        DCHECK(pending_web_ui_);
        pending_web_ui_type_ = new_web_ui_type;

   void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
   std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
-      const GURL& url) override;
+	  const GURL& url,
+	  const std::string& frame_name) override;
   void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
   void OnFocusedElementChangedInFrame(
       RenderFrameHostImpl* frame,

index 4fa796b38b3f..376e8e143770 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -685,12 +685,34 @@ RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() {
   return GetRenderManager();
 }
 
+void SendMessageToFrameTreeWebUIs(RenderFrameHostImpl* parent_frame_host,
+                                  const IPC::Message& message,
+                                  int& dispatch_count) {
+  // Get the web ui or the pending one if it's not yet commited.
+  WebUIImpl* web_ui = parent_frame_host->web_ui()
+      ? parent_frame_host->web_ui()
+      : parent_frame_host->pending_web_ui();
+  if (web_ui && web_ui->OnMessageReceived(message)) {
+    ++dispatch_count;
+  }
+
+  size_t child_count = parent_frame_host->frame_tree_node()->child_count();
+  for (size_t i = 0; i < child_count; ++i) {
+    RenderFrameHostImpl* sub_frame_host =
+        parent_frame_host->frame_tree_node()->child_at(i)->current_frame_host();
+    SendMessageToFrameTreeWebUIs(sub_frame_host, message, dispatch_count);
+  }
+}
+
 bool WebContentsImpl::OnMessageReceived(RenderViewHostImpl* render_view_host,
                                         const IPC::Message& message) {
   RenderFrameHost* main_frame = render_view_host->GetMainFrame();
+  int dispatch_count = 0;
   if (main_frame) {
-    WebUIImpl* web_ui = static_cast<RenderFrameHostImpl*>(main_frame)->web_ui();
-    if (web_ui && web_ui->OnMessageReceived(message))
+    RenderFrameHostImpl* main_frame_host =
+        static_cast<RenderFrameHostImpl*>(main_frame);
+    SendMessageToFrameTreeWebUIs(main_frame_host, message, dispatch_count);
+    if (dispatch_count > 0)
       return true;
   }
 
@@ -5021,8 +5043,9 @@ NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() {
 }
 
 std::unique_ptr<WebUIImpl> WebContentsImpl::CreateWebUIForRenderFrameHost(
-    const GURL& url) {
-  return CreateWebUI(url, std::string());
+    const GURL &url,
+    const std::string& frame_name) {
+  return CreateWebUI(url, frame_name);
 }
 
 NavigationEntry*
