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/gtk/tab_contents_container_gtk.h" | 9 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" |
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
12 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" | 11 #include "chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h" |
13 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 12 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
14 #include "content/browser/renderer_host/render_view_host.h" | 13 #include "content/browser/renderer_host/render_view_host.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
16 #include "content/common/notification_source.h" | 15 #include "content/common/notification_source.h" |
| 16 #include "ui/base/gtk/gtk_hig_constants.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 class ConstrainedHtmlDelegateGtk : public ConstrainedWindowGtkDelegate, | 19 class ConstrainedHtmlDelegateGtk : public ConstrainedWindowGtkDelegate, |
20 public HtmlDialogTabContentsDelegate, | 20 public HtmlDialogTabContentsDelegate, |
21 public ConstrainedHtmlUIDelegate { | 21 public ConstrainedHtmlUIDelegate { |
22 public: | 22 public: |
23 ConstrainedHtmlDelegateGtk(Profile* profile, | 23 ConstrainedHtmlDelegateGtk(Profile* profile, |
24 HtmlDialogUIDelegate* delegate); | 24 HtmlDialogUIDelegate* delegate); |
25 | 25 |
26 virtual ~ConstrainedHtmlDelegateGtk(); | 26 virtual ~ConstrainedHtmlDelegateGtk(); |
27 | 27 |
28 // ConstrainedWindowGtkDelegate ---------------------------------------------- | 28 // ConstrainedWindowGtkDelegate ---------------------------------------------- |
29 virtual GtkWidget* GetWidgetRoot() { | 29 virtual GtkWidget* GetWidgetRoot() { |
30 return tab_contents_container_.widget(); | 30 return tab_contents_container_.widget(); |
31 } | 31 } |
32 virtual GtkWidget* GetFocusWidget() { | 32 virtual GtkWidget* GetFocusWidget() { |
33 return tab_.tab_contents()->GetContentNativeView(); | 33 return tab_.tab_contents()->GetContentNativeView(); |
34 } | 34 } |
35 virtual void DeleteDelegate() { | 35 virtual void DeleteDelegate() { |
36 html_delegate_->OnWindowClosed(); | 36 html_delegate_->OnWindowClosed(); |
37 html_delegate_->OnDialogClosed(""); | 37 html_delegate_->OnDialogClosed(""); |
38 delete this; | 38 delete this; |
39 } | 39 } |
40 | 40 |
41 // ConstrainedHtmlDelegate --------------------------------------------- | 41 // ConstrainedHtmlDelegate --------------------------------------------- |
42 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate(); | 42 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate(); |
43 virtual void OnDialogClose(); | 43 virtual void OnDialogClose(); |
44 virtual bool GetBackgroundColor(GdkColor* color) { | 44 virtual bool GetBackgroundColor(GdkColor* color) { |
45 *color = gtk_util::kGdkWhite; | 45 *color = ui::kGdkWhite; |
46 return true; | 46 return true; |
47 } | 47 } |
48 | 48 |
49 // HtmlDialogTabContentsDelegate --------------------------------------------- | 49 // HtmlDialogTabContentsDelegate --------------------------------------------- |
50 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} | 50 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} |
51 | 51 |
52 void set_window(ConstrainedWindow* window) { | 52 void set_window(ConstrainedWindow* window) { |
53 window_ = window; | 53 window_ = window; |
54 } | 54 } |
55 | 55 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 Profile* profile, | 108 Profile* profile, |
109 HtmlDialogUIDelegate* delegate, | 109 HtmlDialogUIDelegate* delegate, |
110 TabContents* overshadowed) { | 110 TabContents* overshadowed) { |
111 ConstrainedHtmlDelegateGtk* constrained_delegate = | 111 ConstrainedHtmlDelegateGtk* constrained_delegate = |
112 new ConstrainedHtmlDelegateGtk(profile, delegate); | 112 new ConstrainedHtmlDelegateGtk(profile, delegate); |
113 ConstrainedWindow* constrained_window = | 113 ConstrainedWindow* constrained_window = |
114 new ConstrainedWindowGtk(overshadowed, constrained_delegate); | 114 new ConstrainedWindowGtk(overshadowed, constrained_delegate); |
115 constrained_delegate->set_window(constrained_window); | 115 constrained_delegate->set_window(constrained_window); |
116 return constrained_window; | 116 return constrained_window; |
117 } | 117 } |
OLD | NEW |