OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 5 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 8 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // ConstrainedWindowGtkDelegate implementation. | 43 // ConstrainedWindowGtkDelegate implementation. |
44 virtual GtkWidget* GetWidgetRoot() OVERRIDE { | 44 virtual GtkWidget* GetWidgetRoot() OVERRIDE { |
45 return GetNativeView(); | 45 return GetNativeView(); |
46 } | 46 } |
47 virtual GtkWidget* GetFocusWidget() OVERRIDE { | 47 virtual GtkWidget* GetFocusWidget() OVERRIDE { |
48 return html_tab_contents_->tab_contents()->GetContentNativeView(); | 48 return html_tab_contents_->tab_contents()->GetContentNativeView(); |
49 } | 49 } |
50 virtual void DeleteDelegate() OVERRIDE { | 50 virtual void DeleteDelegate() OVERRIDE { |
51 if (!closed_via_webui_) | 51 if (!closed_via_webui_) |
52 html_delegate_->OnDialogClosed(""); | 52 html_delegate_->OnDialogClosed(""); |
53 tab_container_->ChangeTabContents(NULL); | 53 tab_container_->ChangeWebContents(NULL); |
54 } | 54 } |
55 virtual bool GetBackgroundColor(GdkColor* color) OVERRIDE { | 55 virtual bool GetBackgroundColor(GdkColor* color) OVERRIDE { |
56 *color = ui::kGdkWhite; | 56 *color = ui::kGdkWhite; |
57 return true; | 57 return true; |
58 } | 58 } |
59 virtual bool ShouldHaveBorderPadding() const OVERRIDE { | 59 virtual bool ShouldHaveBorderPadding() const OVERRIDE { |
60 return false; | 60 return false; |
61 } | 61 } |
62 | 62 |
63 // HtmlDialogTabContentsDelegate interface. | 63 // HtmlDialogTabContentsDelegate interface. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 content::Referrer(), | 107 content::Referrer(), |
108 content::PAGE_TRANSITION_START_PAGE, | 108 content::PAGE_TRANSITION_START_PAGE, |
109 std::string()); | 109 std::string()); |
110 | 110 |
111 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 111 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
112 params.native_widget = this; | 112 params.native_widget = this; |
113 GetWidget()->Init(params); | 113 GetWidget()->Init(params); |
114 | 114 |
115 tab_container_ = new TabContentsContainer; | 115 tab_container_ = new TabContentsContainer; |
116 GetWidget()->SetContentsView(tab_container_); | 116 GetWidget()->SetContentsView(tab_container_); |
117 tab_container_->ChangeTabContents(html_tab_contents_->tab_contents()); | 117 tab_container_->ChangeWebContents(html_tab_contents_->web_contents()); |
118 | 118 |
119 gfx::Size dialog_size; | 119 gfx::Size dialog_size; |
120 html_delegate_->GetDialogSize(&dialog_size); | 120 html_delegate_->GetDialogSize(&dialog_size); |
121 gtk_widget_set_size_request(GetWidgetRoot(), | 121 gtk_widget_set_size_request(GetWidgetRoot(), |
122 dialog_size.width(), | 122 dialog_size.width(), |
123 dialog_size.height()); | 123 dialog_size.height()); |
124 } | 124 } |
125 | 125 |
126 ConstrainedHtmlDelegateGtk::~ConstrainedHtmlDelegateGtk() { | 126 ConstrainedHtmlDelegateGtk::~ConstrainedHtmlDelegateGtk() { |
127 if (release_tab_on_close_) | 127 if (release_tab_on_close_) |
(...skipping 14 matching lines...) Expand all Loading... |
142 Profile* profile, | 142 Profile* profile, |
143 HtmlDialogUIDelegate* delegate, | 143 HtmlDialogUIDelegate* delegate, |
144 TabContentsWrapper* wrapper) { | 144 TabContentsWrapper* wrapper) { |
145 ConstrainedHtmlDelegateGtk* constrained_delegate = | 145 ConstrainedHtmlDelegateGtk* constrained_delegate = |
146 new ConstrainedHtmlDelegateGtk(profile, delegate); | 146 new ConstrainedHtmlDelegateGtk(profile, delegate); |
147 ConstrainedWindow* constrained_window = | 147 ConstrainedWindow* constrained_window = |
148 new ConstrainedWindowGtk(wrapper, constrained_delegate); | 148 new ConstrainedWindowGtk(wrapper, constrained_delegate); |
149 constrained_delegate->set_window(constrained_window); | 149 constrained_delegate->set_window(constrained_window); |
150 return constrained_delegate; | 150 return constrained_delegate; |
151 } | 151 } |
OLD | NEW |