Home | History | Annotate | Download | only in renderer
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/renderer/one_click_signin_agent.h"
      6 
      7 #include "chrome/common/one_click_signin_messages.h"
      8 #include "content/public/common/password_form.h"
      9 #include "content/public/renderer/document_state.h"
     10 #include "content/public/renderer/render_view.h"
     11 #include "third_party/WebKit/public/web/WebFormElement.h"
     12 #include "third_party/WebKit/public/web/WebFrame.h"
     13 
     14 OneClickSigninAgent::OneClickSigninAgent(
     15     content::RenderView* render_view)
     16     : content::RenderViewObserver(render_view) {
     17 }
     18 
     19 OneClickSigninAgent::~OneClickSigninAgent() {}
     20 
     21 void OneClickSigninAgent::WillSubmitForm(WebKit::WebFrame* frame,
     22                                          const WebKit::WebFormElement& form) {
     23   content::DocumentState* document_state =
     24       content::DocumentState::FromDataSource(frame->provisionalDataSource());
     25   if (document_state->password_form_data()) {
     26     Send(new OneClickSigninHostMsg_FormSubmitted(routing_id(),
     27          *(document_state->password_form_data())));
     28   }
     29 }
     30