| 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/views/html_dialog_view.h" | 5 #include "chrome/browser/ui/views/html_dialog_view.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" | |
| 8 #include "chrome/browser/tab_contents/tab_contents.h" | 7 #include "chrome/browser/tab_contents/tab_contents.h" |
| 9 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/views/window.h" | 9 #include "chrome/browser/ui/views/window.h" |
| 11 #include "chrome/common/native_web_keyboard_event.h" | 10 #include "chrome/common/native_web_keyboard_event.h" |
| 11 #include "ui/base/keycodes/keyboard_codes.h" |
| 12 #include "views/widget/root_view.h" | 12 #include "views/widget/root_view.h" |
| 13 #include "views/widget/widget.h" | 13 #include "views/widget/widget.h" |
| 14 #include "views/window/window.h" | 14 #include "views/window/window.h" |
| 15 | 15 |
| 16 #if defined(OS_LINUX) | 16 #if defined(OS_LINUX) |
| 17 #include "views/window/window_gtk.h" | 17 #include "views/window/window_gtk.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace browser { | 20 namespace browser { |
| 21 | 21 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 gfx::Size HtmlDialogView::GetPreferredSize() { | 50 gfx::Size HtmlDialogView::GetPreferredSize() { |
| 51 gfx::Size out; | 51 gfx::Size out; |
| 52 if (delegate_) | 52 if (delegate_) |
| 53 delegate_->GetDialogSize(&out); | 53 delegate_->GetDialogSize(&out); |
| 54 return out; | 54 return out; |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool HtmlDialogView::AcceleratorPressed(const views::Accelerator& accelerator) { | 57 bool HtmlDialogView::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 58 // Pressing ESC closes the dialog. | 58 // Pressing ESC closes the dialog. |
| 59 DCHECK_EQ(app::VKEY_ESCAPE, accelerator.GetKeyCode()); | 59 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.GetKeyCode()); |
| 60 OnDialogClosed(std::string()); | 60 OnDialogClosed(std::string()); |
| 61 return true; | 61 return true; |
| 62 } | 62 } |
| 63 | 63 |
| 64 //////////////////////////////////////////////////////////////////////////////// | 64 //////////////////////////////////////////////////////////////////////////////// |
| 65 // HtmlDialogView, views::WindowDelegate implementation: | 65 // HtmlDialogView, views::WindowDelegate implementation: |
| 66 | 66 |
| 67 bool HtmlDialogView::CanResize() const { | 67 bool HtmlDialogView::CanResize() const { |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 DOMView::Init(profile(), NULL); | 207 DOMView::Init(profile(), NULL); |
| 208 | 208 |
| 209 tab_contents_->set_delegate(this); | 209 tab_contents_->set_delegate(this); |
| 210 | 210 |
| 211 // Set the delegate. This must be done before loading the page. See | 211 // Set the delegate. This must be done before loading the page. See |
| 212 // the comment above HtmlDialogUI in its header file for why. | 212 // the comment above HtmlDialogUI in its header file for why. |
| 213 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), | 213 HtmlDialogUI::GetPropertyAccessor().SetProperty(tab_contents_->property_bag(), |
| 214 this); | 214 this); |
| 215 | 215 |
| 216 // Pressing the ESC key will close the dialog. | 216 // Pressing the ESC key will close the dialog. |
| 217 AddAccelerator(views::Accelerator(app::VKEY_ESCAPE, false, false, false)); | 217 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); |
| 218 | 218 |
| 219 DOMView::LoadURL(GetDialogContentURL()); | 219 DOMView::LoadURL(GetDialogContentURL()); |
| 220 } | 220 } |
| OLD | NEW |