Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui/chromeos/mobile_setup_dialog.h" | 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | |
| 14 #include "chrome/browser/ui/webui/web_dialog_delegate.h" | 13 #include "chrome/browser/ui/webui/web_dialog_delegate.h" |
| 15 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/browser_thread.h" | |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 18 | 18 |
| 19 using content::BrowserThread; | 19 using content::BrowserThread; |
| 20 using content::WebContents; | 20 using content::WebContents; |
| 21 using content::WebUIMessageHandler; | 21 using content::WebUIMessageHandler; |
| 22 | 22 |
| 23 class MobileSetupDialogDelegate : public WebDialogDelegate { | 23 class MobileSetupDialogDelegate : public WebDialogDelegate { |
| 24 public: | 24 public: |
| 25 static MobileSetupDialogDelegate* GetInstance(); | 25 static MobileSetupDialogDelegate* GetInstance(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 return Singleton<MobileSetupDialogDelegate>::get(); | 65 return Singleton<MobileSetupDialogDelegate>::get(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 MobileSetupDialogDelegate::MobileSetupDialogDelegate() { | 68 MobileSetupDialogDelegate::MobileSetupDialogDelegate() { |
| 69 } | 69 } |
| 70 | 70 |
| 71 MobileSetupDialogDelegate::~MobileSetupDialogDelegate() { | 71 MobileSetupDialogDelegate::~MobileSetupDialogDelegate() { |
| 72 } | 72 } |
| 73 | 73 |
| 74 void MobileSetupDialogDelegate::ShowDialog() { | 74 void MobileSetupDialogDelegate::ShowDialog() { |
| 75 Browser* browser = BrowserList::GetLastActive(); | 75 browser::ShowWebDialog(NULL, |
| 76 if (!browser) | 76 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
|
Ben Goodger (Google)
2012/05/22 17:58:30
Is this how you get the active profile on cros?
zel
2012/05/22 18:02:32
I think so, even though GetDefaultProfileOrOffTheR
Nikita (slow)
2012/05/23 19:01:20
This is an ugly hack that we're planning to get ri
| |
| 77 return; | 77 NULL, |
| 78 browser->BrowserShowWebDialog(this, NULL); | 78 this); |
| 79 } | 79 } |
| 80 | 80 |
| 81 ui::ModalType MobileSetupDialogDelegate::GetDialogModalType() const { | 81 ui::ModalType MobileSetupDialogDelegate::GetDialogModalType() const { |
| 82 return ui::MODAL_TYPE_SYSTEM; | 82 return ui::MODAL_TYPE_SYSTEM; |
| 83 } | 83 } |
| 84 | 84 |
| 85 string16 MobileSetupDialogDelegate::GetDialogTitle() const { | 85 string16 MobileSetupDialogDelegate::GetDialogTitle() const { |
| 86 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); | 86 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool MobileSetupDialogDelegate::ShouldShowDialogTitle() const { | 117 bool MobileSetupDialogDelegate::ShouldShowDialogTitle() const { |
| 118 return true; | 118 return true; |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool MobileSetupDialogDelegate::HandleContextMenu( | 121 bool MobileSetupDialogDelegate::HandleContextMenu( |
| 122 const content::ContextMenuParams& params) { | 122 const content::ContextMenuParams& params) { |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| OLD | NEW |