summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/constrained_html_dialog_win.h
blob: 8ce83f33cac82e9dbb7c84a54f0282ab1959a56d (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2006-2008 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.

#ifndef CHROME_BROWSER_VIEWS_CONSTRAINED_HTML_DIALOG_WIN_H_
#define CHROME_BROWSER_VIEWS_CONSTRAINED_HTML_DIALOG_WIN_H_
#pragma once

#include "chrome/browser/dom_ui/constrained_html_dialog.h"

#include "chrome/browser/dom_ui/html_dialog_ui.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/renderer_preferences.h"
#include "views/controls/native/native_view_host.h"
#include "views/window/window_delegate.h"

class RenderViewHost;
class RenderWidgetHostViewWin;

class ConstrainedHtmlDialogWin : public ConstrainedHtmlDialog,
                                 public ConstrainedWindowDelegate,
                                 public RenderViewHostDelegate {
 public:
  ConstrainedHtmlDialogWin(Profile* profile,
                           HtmlDialogUIDelegate* delegate);
  ~ConstrainedHtmlDialogWin();

  // Called when the dialog is actually being added to the views hierarchy.
  void Init(gfx::NativeView parent_window);

  // ConstrainedHtmlDialog override.
  virtual ConstrainedWindowDelegate* GetConstrainedWindowDelegate();

  // ConstrainedWindowDelegate (aka views::WindowDelegate) override.
  virtual bool CanResize() const;
  virtual views::View* GetContentsView();
  virtual void WindowClosing();

  // RenderViewHostDelegate overrides.
  virtual int GetBrowserWindowID() const;
  virtual ViewType::Type GetRenderViewType() const;
  virtual RendererPreferences GetRendererPrefs(Profile* profile) const;
  virtual void ProcessDOMUIMessage(
      const ViewHostMsg_DomMessage_Params& params);

 private:
  SiteInstance* site_instance_;
  scoped_ptr<RenderViewHost> render_view_host_;

  // URL to be displayed in the dialog.
  GURL dialog_url_;

  // Pointer owned by the |render_view_host_| object.
  RenderWidgetHostViewWin* render_widget_host_view_;

  // View pointer owned by the views hierarchy.
  views::NativeViewHost* native_view_host_;
};

#endif  // CHROME_BROWSER_VIEWS_CONSTRAINED_HTML_DIALOG_WIN_H_