summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/autofill/autofill_dialog_sign_in_delegate.cc
blob: fab3ffd45d9bcfc5256e220ba52a5dafaf6a435b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/autofill/autofill_dialog_sign_in_delegate.h"

#include "chrome/browser/ui/autofill/autofill_dialog_view.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"

namespace autofill {

AutofillDialogSignInDelegate::AutofillDialogSignInDelegate(
    AutofillDialogView* dialog_view,
    content::WebContents* web_contents)
    : WebContentsObserver(web_contents),
      dialog_view_(dialog_view) {
  web_contents->SetDelegate(this);
}

void AutofillDialogSignInDelegate::ResizeDueToAutoResize(
    content::WebContents* source, const gfx::Size& pref_size) {
  dialog_view_->OnSignInResize(pref_size);
}

void AutofillDialogSignInDelegate::RenderViewCreated(
    content::RenderViewHost* render_view_host) {
  // Sizes to be used for the sign-in Window.
  const gfx::Size kSignInWindowMinSize(400, 331);
  const gfx::Size kSignInWindowMaxSize(800, 600);

  render_view_host->EnableAutoResize(kSignInWindowMinSize,
                                     kSignInWindowMaxSize);
  // Set the initial size as soon as we have an RVH to avoid
  // bad size jumping.
  dialog_view_->OnSignInResize(kSignInWindowMinSize);
}

}  // namespace autofill