| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/views/window.h" | 11 #include "chrome/browser/ui/views/window.h" |
| 11 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
| 12 #include "content/common/native_web_keyboard_event.h" | 13 #include "content/common/native_web_keyboard_event.h" |
| 13 #include "content/common/content_notification_types.h" | 14 #include "content/common/content_notification_types.h" |
| 14 #include "content/common/notification_details.h" | 15 #include "content/common/notification_details.h" |
| 15 #include "content/common/notification_source.h" | 16 #include "content/common/notification_source.h" |
| 16 #include "ui/base/keycodes/keyboard_codes.h" | 17 #include "ui/base/keycodes/keyboard_codes.h" |
| 17 #include "views/events/event.h" | 18 #include "views/events/event.h" |
| 18 #include "views/widget/root_view.h" | 19 #include "views/widget/root_view.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 94 } |
| 94 | 95 |
| 95 bool HtmlDialogView::IsModal() const { | 96 bool HtmlDialogView::IsModal() const { |
| 96 if (delegate_) | 97 if (delegate_) |
| 97 return delegate_->IsDialogModal(); | 98 return delegate_->IsDialogModal(); |
| 98 return false; | 99 return false; |
| 99 } | 100 } |
| 100 | 101 |
| 101 std::wstring HtmlDialogView::GetWindowTitle() const { | 102 std::wstring HtmlDialogView::GetWindowTitle() const { |
| 102 if (delegate_) | 103 if (delegate_) |
| 103 return delegate_->GetDialogTitle(); | 104 return UTF16ToWideHack(delegate_->GetDialogTitle()); |
| 104 return std::wstring(); | 105 return std::wstring(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 void HtmlDialogView::WindowClosing() { | 108 void HtmlDialogView::WindowClosing() { |
| 108 // If we still have a delegate that means we haven't notified it of the | 109 // If we still have a delegate that means we haven't notified it of the |
| 109 // dialog closing. This happens if the user clicks the Close button on the | 110 // dialog closing. This happens if the user clicks the Close button on the |
| 110 // dialog. | 111 // dialog. |
| 111 if (delegate_) { | 112 if (delegate_) { |
| 112 OnWindowClosed(); | 113 OnWindowClosed(); |
| 113 OnDialogClosed(""); | 114 OnDialogClosed(""); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 134 return View::GetWidget(); | 135 return View::GetWidget(); |
| 135 } | 136 } |
| 136 | 137 |
| 137 //////////////////////////////////////////////////////////////////////////////// | 138 //////////////////////////////////////////////////////////////////////////////// |
| 138 // HtmlDialogUIDelegate implementation: | 139 // HtmlDialogUIDelegate implementation: |
| 139 | 140 |
| 140 bool HtmlDialogView::IsDialogModal() const { | 141 bool HtmlDialogView::IsDialogModal() const { |
| 141 return IsModal(); | 142 return IsModal(); |
| 142 } | 143 } |
| 143 | 144 |
| 144 std::wstring HtmlDialogView::GetDialogTitle() const { | 145 string16 HtmlDialogView::GetDialogTitle() const { |
| 145 return GetWindowTitle(); | 146 return WideToUTF16Hack(GetWindowTitle()); |
| 146 } | 147 } |
| 147 | 148 |
| 148 GURL HtmlDialogView::GetDialogContentURL() const { | 149 GURL HtmlDialogView::GetDialogContentURL() const { |
| 149 if (delegate_) | 150 if (delegate_) |
| 150 return delegate_->GetDialogContentURL(); | 151 return delegate_->GetDialogContentURL(); |
| 151 return GURL(); | 152 return GURL(); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void HtmlDialogView::GetWebUIMessageHandlers( | 155 void HtmlDialogView::GetWebUIMessageHandlers( |
| 155 std::vector<WebUIMessageHandler*>* handlers) const { | 156 std::vector<WebUIMessageHandler*>* handlers) const { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 break; | 289 break; |
| 289 default: | 290 default: |
| 290 NOTREACHED() << "unknown type" << type; | 291 NOTREACHED() << "unknown type" << type; |
| 291 } | 292 } |
| 292 } | 293 } |
| 293 | 294 |
| 294 void HtmlDialogView::RegisterDialogAccelerators() { | 295 void HtmlDialogView::RegisterDialogAccelerators() { |
| 295 // Pressing the ESC key will close the dialog. | 296 // Pressing the ESC key will close the dialog. |
| 296 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); | 297 AddAccelerator(views::Accelerator(ui::VKEY_ESCAPE, false, false, false)); |
| 297 } | 298 } |
| OLD | NEW |