OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" |
| 6 |
| 7 #include "app/l10n_util.h" |
| 8 #include "base/scoped_ptr.h" |
| 9 #include "chrome/browser/browser_list.h" |
| 10 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/common/url_constants.h" |
| 13 #include "grit/generated_resources.h" |
| 14 |
| 15 |
| 16 void KeyboardOverlayDelegate::ShowDialog(gfx::NativeWindow owning_window) { |
| 17 Browser* browser = BrowserList::GetLastActive(); |
| 18 KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate( |
| 19 l10n_util::GetString(IDS_KEYBOARD_OVERLAY_TITLE)); |
| 20 DCHECK(browser); |
| 21 browser->BrowserShowHtmlDialog(delegate, owning_window); |
| 22 } |
| 23 |
| 24 KeyboardOverlayDelegate::KeyboardOverlayDelegate( |
| 25 const std::wstring& title) |
| 26 : title_(title) { |
| 27 } |
| 28 |
| 29 KeyboardOverlayDelegate::~KeyboardOverlayDelegate() { |
| 30 } |
| 31 |
| 32 bool KeyboardOverlayDelegate::IsDialogModal() const { |
| 33 return true; |
| 34 } |
| 35 |
| 36 std::wstring KeyboardOverlayDelegate::GetDialogTitle() const { |
| 37 return title_; |
| 38 } |
| 39 |
| 40 GURL KeyboardOverlayDelegate::GetDialogContentURL() const { |
| 41 std::string url_string(chrome::kChromeUIKeyboardOverlayURL); |
| 42 return GURL(url_string); |
| 43 } |
| 44 |
| 45 void KeyboardOverlayDelegate::GetDOMMessageHandlers( |
| 46 std::vector<DOMMessageHandler*>* handlers) const { |
| 47 } |
| 48 |
| 49 void KeyboardOverlayDelegate::GetDialogSize( |
| 50 gfx::Size* size) const { |
| 51 size->SetSize(1170, 483); |
| 52 } |
| 53 |
| 54 std::string KeyboardOverlayDelegate::GetDialogArgs() const { |
| 55 return "[]"; |
| 56 } |
| 57 |
| 58 void KeyboardOverlayDelegate::OnDialogClosed( |
| 59 const std::string& json_retval) { |
| 60 delete this; |
| 61 return; |
| 62 } |
| 63 |
| 64 void KeyboardOverlayDelegate::OnCloseContents(TabContents* source, |
| 65 bool* out_close_dialog) { |
| 66 } |
| 67 |
| 68 bool KeyboardOverlayDelegate::ShouldShowDialogTitle() const { |
| 69 return false; |
| 70 } |
OLD | NEW |