OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/memory/singleton.h" |
| 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/platform_util.h" |
| 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/webui/html_dialog_ui.h" |
| 15 #include "chrome/common/url_constants.h" |
| 16 #include "grit/generated_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" |
| 18 |
| 19 // static |
| 20 MobileSetupDialog* MobileSetupDialog::GetInstance() { |
| 21 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 22 return Singleton<MobileSetupDialog>::get(); |
| 23 } |
| 24 |
| 25 MobileSetupDialog::MobileSetupDialog() { |
| 26 } |
| 27 |
| 28 MobileSetupDialog::~MobileSetupDialog() { |
| 29 } |
| 30 |
| 31 // static |
| 32 void MobileSetupDialog::Show() { |
| 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 34 MobileSetupDialog* dialog = MobileSetupDialog::GetInstance(); |
| 35 dialog->ShowDialog(); |
| 36 } |
| 37 |
| 38 void MobileSetupDialog::ShowDialog() { |
| 39 Browser* browser = BrowserList::GetLastActive(); |
| 40 if (!browser) |
| 41 return; |
| 42 browser->BrowserShowHtmlDialog(this, NULL); |
| 43 } |
| 44 |
| 45 bool MobileSetupDialog::IsDialogModal() const { |
| 46 return true; |
| 47 } |
| 48 |
| 49 string16 MobileSetupDialog::GetDialogTitle() const { |
| 50 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); |
| 51 } |
| 52 |
| 53 GURL MobileSetupDialog::GetDialogContentURL() const { |
| 54 return GURL(chrome::kChromeUIMobileSetupURL); |
| 55 } |
| 56 |
| 57 void MobileSetupDialog::GetWebUIMessageHandlers( |
| 58 std::vector<WebUIMessageHandler*>* handlers) const{ |
| 59 } |
| 60 |
| 61 void MobileSetupDialog::GetDialogSize(gfx::Size* size) const { |
| 62 #if defined(POST_PORTAL) |
| 63 size->SetSize(850, 650); |
| 64 #else |
| 65 size->SetSize(1100, 700); |
| 66 #endif |
| 67 } |
| 68 |
| 69 std::string MobileSetupDialog::GetDialogArgs() const { |
| 70 return std::string(); |
| 71 } |
| 72 |
| 73 void MobileSetupDialog::OnDialogClosed(const std::string& json_retval) { |
| 74 } |
| 75 |
| 76 void MobileSetupDialog::OnCloseContents(TabContents* source, |
| 77 bool* out_close_dialog) { |
| 78 *out_close_dialog = true; |
| 79 } |
| 80 |
| 81 bool MobileSetupDialog::ShouldShowDialogTitle() const { |
| 82 return true; |
| 83 } |
| 84 |
| 85 bool MobileSetupDialog::HandleContextMenu(const ContextMenuParams& params) { |
| 86 return true; |
| 87 } |
OLD | NEW |