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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.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/constrained_window_views.h" | 10 #include "chrome/browser/ui/views/constrained_window_views.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // ConstrainedHtmlUIDelegate interface. | 28 // ConstrainedHtmlUIDelegate interface. |
29 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() OVERRIDE; | 29 virtual HtmlDialogUIDelegate* GetHtmlDialogUIDelegate() OVERRIDE; |
30 virtual void OnDialogCloseFromWebUI() OVERRIDE; | 30 virtual void OnDialogCloseFromWebUI() OVERRIDE; |
31 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE; | 31 virtual void ReleaseTabContentsOnDialogClose() OVERRIDE; |
32 virtual ConstrainedWindow* window() OVERRIDE { return window_; } | 32 virtual ConstrainedWindow* window() OVERRIDE { return window_; } |
33 virtual TabContentsWrapper* tab() OVERRIDE { | 33 virtual TabContentsWrapper* tab() OVERRIDE { |
34 return html_tab_contents_.get(); | 34 return html_tab_contents_.get(); |
35 } | 35 } |
36 | 36 |
37 // views::WidgetDelegate interface. | 37 // views::WidgetDelegate interface. |
| 38 virtual views::View* GetInitiallyFocusedView() OVERRIDE { |
| 39 return GetFocusView(); |
| 40 } |
38 virtual bool CanResize() const OVERRIDE { return true; } | 41 virtual bool CanResize() const OVERRIDE { return true; } |
39 virtual views::View* GetContentsView() OVERRIDE { | |
40 return this; | |
41 } | |
42 virtual void WindowClosing() OVERRIDE { | 42 virtual void WindowClosing() OVERRIDE { |
43 if (!closed_via_webui_) | 43 if (!closed_via_webui_) |
44 html_delegate_->OnDialogClosed(std::string()); | 44 html_delegate_->OnDialogClosed(std::string()); |
45 } | 45 } |
46 virtual views::Widget* GetWidget() OVERRIDE { | 46 virtual views::Widget* GetWidget() OVERRIDE { |
47 return View::GetWidget(); | 47 return View::GetWidget(); |
48 } | 48 } |
49 virtual const views::Widget* GetWidget() const OVERRIDE { | 49 virtual const views::Widget* GetWidget() const OVERRIDE { |
50 return View::GetWidget(); | 50 return View::GetWidget(); |
51 } | 51 } |
52 | |
53 virtual string16 GetWindowTitle() const OVERRIDE { | 52 virtual string16 GetWindowTitle() const OVERRIDE { |
54 return html_delegate_->GetDialogTitle(); | 53 return html_delegate_->GetDialogTitle(); |
55 } | 54 } |
| 55 virtual views::View* GetContentsView() OVERRIDE { |
| 56 return this; |
| 57 } |
56 | 58 |
57 // HtmlDialogTabContentsDelegate interface. | 59 // HtmlDialogTabContentsDelegate interface. |
58 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) OVERRIDE {} | 60 void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) OVERRIDE {} |
59 virtual void CloseContents(TabContents* source) OVERRIDE { | 61 virtual void CloseContents(TabContents* source) OVERRIDE { |
60 window_->CloseConstrainedWindow(); | 62 window_->CloseConstrainedWindow(); |
61 } | 63 } |
62 | 64 |
63 // Overridden from TabContentsContainer. | 65 // Overridden from TabContentsContainer. |
64 virtual gfx::Size GetPreferredSize() OVERRIDE { | 66 virtual gfx::Size GetPreferredSize() OVERRIDE { |
65 gfx::Size size; | 67 gfx::Size size; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 Profile* profile, | 144 Profile* profile, |
143 HtmlDialogUIDelegate* delegate, | 145 HtmlDialogUIDelegate* delegate, |
144 TabContentsWrapper* container) { | 146 TabContentsWrapper* container) { |
145 ConstrainedHtmlDelegateViews* constrained_delegate = | 147 ConstrainedHtmlDelegateViews* constrained_delegate = |
146 new ConstrainedHtmlDelegateViews(profile, delegate); | 148 new ConstrainedHtmlDelegateViews(profile, delegate); |
147 ConstrainedWindow* constrained_window = | 149 ConstrainedWindow* constrained_window = |
148 new ConstrainedWindowViews(container, constrained_delegate); | 150 new ConstrainedWindowViews(container, constrained_delegate); |
149 constrained_delegate->set_window(constrained_window); | 151 constrained_delegate->set_window(constrained_window); |
150 return constrained_delegate; | 152 return constrained_delegate; |
151 } | 153 } |
OLD | NEW |