Chromium Code Reviews
|
| 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 browser->BrowserShowHtmlDialog(this, NULL); | |
|
xiyuan
2011/10/15 15:56:19
browser could be NULL.
zel
2011/10/18 22:22:16
Done.
| |
| 41 } | |
| 42 | |
| 43 bool MobileSetupDialog::IsDialogModal() const { | |
| 44 return false; | |
|
xiyuan
2011/10/15 15:56:19
Do we really want to use a modaless dialog? Withou
zel
2011/10/18 22:22:16
Done.
| |
| 45 } | |
| 46 | |
| 47 string16 MobileSetupDialog::GetDialogTitle() const { | |
| 48 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); | |
| 49 } | |
| 50 | |
| 51 GURL MobileSetupDialog::GetDialogContentURL() const { | |
| 52 return GURL(chrome::kChromeUIMobileSetupURL); | |
| 53 } | |
| 54 | |
| 55 void MobileSetupDialog::GetWebUIMessageHandlers( | |
| 56 std::vector<WebUIMessageHandler*>* handlers) const{ | |
| 57 } | |
| 58 | |
| 59 void MobileSetupDialog::GetDialogSize(gfx::Size* size) const { | |
| 60 size->SetSize(850, 650); | |
| 61 } | |
| 62 | |
| 63 std::string MobileSetupDialog::GetDialogArgs() const { | |
| 64 return std::string(); | |
| 65 } | |
| 66 | |
| 67 void MobileSetupDialog::OnDialogClosed(const std::string& json_retval) { | |
| 68 } | |
| 69 | |
| 70 void MobileSetupDialog::OnCloseContents(TabContents* source, | |
| 71 bool* out_close_dialog) { | |
| 72 *out_close_dialog = true; | |
| 73 } | |
| 74 | |
| 75 bool MobileSetupDialog::ShouldShowDialogTitle() const { | |
| 76 return true; | |
| 77 } | |
| 78 | |
| 79 bool MobileSetupDialog::HandleContextMenu(const ContextMenuParams& params) { | |
| 80 return true; | |
|
xiyuan
2011/10/15 15:56:19
We might only want to return true for DEBUG build.
| |
| 81 } | |
| OLD | NEW |