| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_web_dialog_delegate_base.h" | 5 #include "chrome/browser/ui/webui/constrained_web_dialog_delegate_base.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.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 10 #include "chrome/browser/ui/views/constrained_window_views.h" | 10 #include "chrome/browser/ui/views/constrained_window_views.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 virtual const views::Widget* GetWidget() const OVERRIDE { | 122 virtual const views::Widget* GetWidget() const OVERRIDE { |
| 123 return View::GetWidget(); | 123 return View::GetWidget(); |
| 124 } | 124 } |
| 125 virtual string16 GetWindowTitle() const OVERRIDE { | 125 virtual string16 GetWindowTitle() const OVERRIDE { |
| 126 return impl_->closed_via_webui() ? string16() : | 126 return impl_->closed_via_webui() ? string16() : |
| 127 GetWebDialogDelegate()->GetDialogTitle(); | 127 GetWebDialogDelegate()->GetDialogTitle(); |
| 128 } | 128 } |
| 129 virtual views::View* GetContentsView() OVERRIDE { | 129 virtual views::View* GetContentsView() OVERRIDE { |
| 130 return this; | 130 return this; |
| 131 } | 131 } |
| 132 virtual void OnWidgetMove() OVERRIDE { | |
| 133 GetWidget()->CenterWindow( | |
| 134 GetWidget()->non_client_view()->GetPreferredSize()); | |
| 135 views::WidgetDelegate::OnWidgetMove(); | |
| 136 } | |
| 137 | 132 |
| 138 // views::WebView overrides. | 133 // views::WebView overrides. |
| 139 virtual bool AcceleratorPressed( | 134 virtual bool AcceleratorPressed( |
| 140 const ui::Accelerator& accelerator) OVERRIDE { | 135 const ui::Accelerator& accelerator) OVERRIDE { |
| 141 // Pressing ESC closes the dialog. | 136 // Pressing ESC closes the dialog. |
| 142 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); | 137 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); |
| 143 window()->CloseConstrainedWindow(); | 138 window()->CloseConstrainedWindow(); |
| 144 return true; | 139 return true; |
| 145 } | 140 } |
| 146 virtual gfx::Size GetPreferredSize() OVERRIDE { | 141 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 ConstrainedWebDialogDelegateViewViews* constrained_delegate = | 182 ConstrainedWebDialogDelegateViewViews* constrained_delegate = |
| 188 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate)
; | 183 new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate)
; |
| 189 ConstrainedWindow* constrained_window = | 184 ConstrainedWindow* constrained_window = |
| 190 new ConstrainedWindowViews(container->web_contents(), | 185 new ConstrainedWindowViews(container->web_contents(), |
| 191 constrained_delegate, | 186 constrained_delegate, |
| 192 false, | 187 false, |
| 193 ConstrainedWindowViews::DEFAULT_INSETS); | 188 ConstrainedWindowViews::DEFAULT_INSETS); |
| 194 constrained_delegate->set_window(constrained_window); | 189 constrained_delegate->set_window(constrained_window); |
| 195 return constrained_delegate; | 190 return constrained_delegate; |
| 196 } | 191 } |
| OLD | NEW |