| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/html_dialog_view.h" | 5 #include "chrome/browser/views/html_dialog_view.h" |
| 6 | 6 |
| 7 #include "base/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
| 10 #include "views/widget/root_view.h" | 10 #include "views/widget/root_view.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // The contained web page wishes to resize itself. We let it do this because | 143 // The contained web page wishes to resize itself. We let it do this because |
| 144 // if it's a dialog we know about, we trust it not to be mean to the user. | 144 // if it's a dialog we know about, we trust it not to be mean to the user. |
| 145 GetWidget()->SetBounds(pos); | 145 GetWidget()->SetBounds(pos); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void HtmlDialogView::ToolbarSizeChanged(TabContents* source, | 148 void HtmlDialogView::ToolbarSizeChanged(TabContents* source, |
| 149 bool is_animating) { | 149 bool is_animating) { |
| 150 Layout(); | 150 Layout(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // A simplified version of BrowserView::HandleKeyboardEvent(). |
| 154 // We don't handle global keyboard shortcuts here, but that's fine since |
| 155 // they're all browser-specific. (This may change in the future.) |
| 156 void HtmlDialogView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 157 #if defined(OS_WIN) |
| 158 // Any unhandled keyboard/character messages should be defproced. |
| 159 // This allows stuff like F10, etc to work correctly. |
| 160 DefWindowProc(event.os_event.hwnd, event.os_event.message, |
| 161 event.os_event.wParam, event.os_event.lParam); |
| 162 #endif |
| 163 } |
| 164 |
| 153 //////////////////////////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////////////////////////// |
| 154 // HtmlDialogView: | 166 // HtmlDialogView: |
| 155 | 167 |
| 156 void HtmlDialogView::InitDialog() { | 168 void HtmlDialogView::InitDialog() { |
| 157 // Now Init the DOMView. This view runs in its own process to render the html. | 169 // Now Init the DOMView. This view runs in its own process to render the html. |
| 158 DOMView::Init(profile(), NULL); | 170 DOMView::Init(profile(), NULL); |
| 159 | 171 |
| 160 tab_contents_->set_delegate(this); | 172 tab_contents_->set_delegate(this); |
| 161 | 173 |
| 162 // Set the delegate. This must be done before loading the page. See | 174 // Set the delegate. This must be done before loading the page. See |
| 163 // the comment above HtmlDialogUI in its header file for why. | 175 // the comment above HtmlDialogUI in its header file for why. |
| 164 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), | 176 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), |
| 165 this); | 177 this); |
| 166 | 178 |
| 167 // Pressing the ESC key will close the dialog. | 179 // Pressing the ESC key will close the dialog. |
| 168 AddAccelerator(views::Accelerator(base::VKEY_ESCAPE, false, false, false)); | 180 AddAccelerator(views::Accelerator(base::VKEY_ESCAPE, false, false, false)); |
| 169 | 181 |
| 170 DOMView::LoadURL(delegate_->GetDialogContentURL()); | 182 DOMView::LoadURL(delegate_->GetDialogContentURL()); |
| 171 } | 183 } |
| OLD | NEW |