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/ui/browser.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" | 13 #include "chrome/browser/ui/browser_list.h" |
14 #include "chrome/browser/ui/dialog_style.h" | 14 #include "chrome/browser/ui/dialog_style.h" |
15 #include "chrome/browser/ui/webui/html_dialog_ui.h" | 15 #include "chrome/browser/ui/webui/web_dialog_ui.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 | 19 |
20 using content::BrowserThread; | 20 using content::BrowserThread; |
21 using content::WebContents; | 21 using content::WebContents; |
22 using content::WebUIMessageHandler; | 22 using content::WebUIMessageHandler; |
23 | 23 |
24 class MobileSetupDialogDelegate : public HtmlDialogUIDelegate { | 24 class MobileSetupDialogDelegate : public WebDialogDelegate { |
25 public: | 25 public: |
26 static MobileSetupDialogDelegate* GetInstance(); | 26 static MobileSetupDialogDelegate* GetInstance(); |
27 void ShowDialog(); | 27 void ShowDialog(); |
28 | 28 |
29 protected: | 29 protected: |
30 friend struct DefaultSingletonTraits<MobileSetupDialogDelegate>; | 30 friend struct DefaultSingletonTraits<MobileSetupDialogDelegate>; |
31 | 31 |
32 MobileSetupDialogDelegate(); | 32 MobileSetupDialogDelegate(); |
33 virtual ~MobileSetupDialogDelegate(); | 33 virtual ~MobileSetupDialogDelegate(); |
34 | 34 |
35 void OnCloseDialog(); | 35 void OnCloseDialog(); |
36 | 36 |
37 // HtmlDialogUIDelegate overrides. | 37 // WebDialogDelegate overrides. |
38 virtual ui::ModalType GetDialogModalType() const OVERRIDE; | 38 virtual ui::ModalType GetDialogModalType() const OVERRIDE; |
39 virtual string16 GetDialogTitle() const OVERRIDE; | 39 virtual string16 GetDialogTitle() const OVERRIDE; |
40 virtual GURL GetDialogContentURL() const OVERRIDE; | 40 virtual GURL GetDialogContentURL() const OVERRIDE; |
41 virtual void GetWebUIMessageHandlers( | 41 virtual void GetWebUIMessageHandlers( |
42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; | 42 std::vector<WebUIMessageHandler*>* handlers) const OVERRIDE; |
43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; | 43 virtual void GetDialogSize(gfx::Size* size) const OVERRIDE; |
44 virtual std::string GetDialogArgs() const OVERRIDE; | 44 virtual std::string GetDialogArgs() const OVERRIDE; |
45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; | 45 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE; |
46 virtual void OnCloseContents(WebContents* source, | 46 virtual void OnCloseContents(WebContents* source, |
47 bool* out_close_dialog) OVERRIDE; | 47 bool* out_close_dialog) OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
69 MobileSetupDialogDelegate::MobileSetupDialogDelegate() { | 69 MobileSetupDialogDelegate::MobileSetupDialogDelegate() { |
70 } | 70 } |
71 | 71 |
72 MobileSetupDialogDelegate::~MobileSetupDialogDelegate() { | 72 MobileSetupDialogDelegate::~MobileSetupDialogDelegate() { |
73 } | 73 } |
74 | 74 |
75 void MobileSetupDialogDelegate::ShowDialog() { | 75 void MobileSetupDialogDelegate::ShowDialog() { |
76 Browser* browser = BrowserList::GetLastActive(); | 76 Browser* browser = BrowserList::GetLastActive(); |
77 if (!browser) | 77 if (!browser) |
78 return; | 78 return; |
79 browser->BrowserShowHtmlDialog(this, NULL, STYLE_GENERIC); | 79 browser->BrowserShowWebDialog(this, NULL, STYLE_GENERIC); |
80 } | 80 } |
81 | 81 |
82 ui::ModalType MobileSetupDialogDelegate::GetDialogModalType() const { | 82 ui::ModalType MobileSetupDialogDelegate::GetDialogModalType() const { |
83 return ui::MODAL_TYPE_SYSTEM; | 83 return ui::MODAL_TYPE_SYSTEM; |
84 } | 84 } |
85 | 85 |
86 string16 MobileSetupDialogDelegate::GetDialogTitle() const { | 86 string16 MobileSetupDialogDelegate::GetDialogTitle() const { |
87 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); | 87 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); |
88 } | 88 } |
89 | 89 |
(...skipping 26 matching lines...) Expand all Loading... |
116 } | 116 } |
117 | 117 |
118 bool MobileSetupDialogDelegate::ShouldShowDialogTitle() const { | 118 bool MobileSetupDialogDelegate::ShouldShowDialogTitle() const { |
119 return true; | 119 return true; |
120 } | 120 } |
121 | 121 |
122 bool MobileSetupDialogDelegate::HandleContextMenu( | 122 bool MobileSetupDialogDelegate::HandleContextMenu( |
123 const content::ContextMenuParams& params) { | 123 const content::ContextMenuParams& params) { |
124 return true; | 124 return true; |
125 } | 125 } |
OLD | NEW |