| 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/gtk/gtk_util.h" | |
| 10 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 9 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
| 11 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" | 10 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" |
| 12 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 11 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 13 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
| 13 #include "ui/base/gtk/gtk_hig_constants.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "views/widget/native_widget_gtk.h" | 15 #include "views/widget/native_widget_gtk.h" |
| 16 | 16 |
| 17 // ConstrainedHtmlDelegateGtk works with ConstrainedWindowGtk to present | 17 // ConstrainedHtmlDelegateGtk works with ConstrainedWindowGtk to present |
| 18 // a TabContents in a ContraintedHtmlUI. | 18 // a TabContents in a ContraintedHtmlUI. |
| 19 class ConstrainedHtmlDelegateGtk : public views::NativeWidgetGtk, | 19 class ConstrainedHtmlDelegateGtk : public views::NativeWidgetGtk, |
| 20 public ConstrainedHtmlUIDelegate, | 20 public ConstrainedHtmlUIDelegate, |
| 21 public ConstrainedWindowGtkDelegate, | 21 public ConstrainedWindowGtkDelegate, |
| 22 public HtmlDialogTabContentsDelegate { | 22 public HtmlDialogTabContentsDelegate { |
| 23 public: | 23 public: |
| 24 ConstrainedHtmlDelegateGtk(Profile* profile, | 24 ConstrainedHtmlDelegateGtk(Profile* profile, |
| 25 HtmlDialogUIDelegate* delegate); | 25 HtmlDialogUIDelegate* delegate); |
| 26 ~ConstrainedHtmlDelegateGtk(); | 26 ~ConstrainedHtmlDelegateGtk(); |
| 27 | 27 |
| 28 // ConstrainedHtmlUIDelegate interface. | 28 // ConstrainedHtmlUIDelegate interface. |
| 29 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate(); | 29 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate(); |
| 30 virtual void OnDialogClose(); | 30 virtual void OnDialogClose(); |
| 31 virtual bool GetBackgroundColor(GdkColor* color) { | 31 virtual bool GetBackgroundColor(GdkColor* color) { |
| 32 *color = gtk_util::kGdkWhite; | 32 *color = ui::kGdkWhite; |
| 33 return true; | 33 return true; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // ConstrainedWindowGtkDelegate implementation. | 36 // ConstrainedWindowGtkDelegate implementation. |
| 37 virtual GtkWidget* GetWidgetRoot() { | 37 virtual GtkWidget* GetWidgetRoot() { |
| 38 return GetNativeView(); | 38 return GetNativeView(); |
| 39 } | 39 } |
| 40 virtual GtkWidget* GetFocusWidget() { | 40 virtual GtkWidget* GetFocusWidget() { |
| 41 return html_tab_contents_.GetContentNativeView(); | 41 return html_tab_contents_.GetContentNativeView(); |
| 42 } | 42 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 Profile* profile, | 116 Profile* profile, |
| 117 HtmlDialogUIDelegate* delegate, | 117 HtmlDialogUIDelegate* delegate, |
| 118 TabContents* container) { | 118 TabContents* container) { |
| 119 ConstrainedHtmlDelegateGtk* constrained_delegate = | 119 ConstrainedHtmlDelegateGtk* constrained_delegate = |
| 120 new ConstrainedHtmlDelegateGtk(profile, delegate); | 120 new ConstrainedHtmlDelegateGtk(profile, delegate); |
| 121 ConstrainedWindow* constrained_window = | 121 ConstrainedWindow* constrained_window = |
| 122 new ConstrainedWindowGtk(container, constrained_delegate); | 122 new ConstrainedWindowGtk(container, constrained_delegate); |
| 123 constrained_delegate->set_window(constrained_window); | 123 constrained_delegate->set_window(constrained_window); |
| 124 return constrained_window; | 124 return constrained_window; |
| 125 } | 125 } |
| OLD | NEW |