OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/chromeos/sim_dialog_delegate.h" | 5 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/browser/chromeos/frame/bubble_window.h" | |
9 #include "chrome/browser/chromeos/login/user_manager.h" | 8 #include "chrome/browser/chromeos/login/user_manager.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" |
12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/views/html_dialog_view.h" | 13 #include "chrome/browser/ui/views/html_dialog_view.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
15 #include "ui/views/view.h" | |
16 #include "ui/views/widget/widget.h" | |
17 | 15 |
18 namespace { | 16 namespace { |
19 | 17 |
20 // Default width/height of the dialog. | 18 // Default width/height of the dialog. |
21 const int kDefaultWidth = 350; | 19 const int kDefaultWidth = 350; |
22 const int kDefaultHeight = 225; | 20 const int kDefaultHeight = 225; |
23 | 21 |
24 // Width/height for the change PIN dialog mode. | 22 // Width/height for the change PIN dialog mode. |
25 const int kChangePinWidth = 350; | 23 const int kChangePinWidth = 350; |
26 const int kChangePinHeight = 245; | 24 const int kChangePinHeight = 245; |
(...skipping 21 matching lines...) Expand all Loading... |
48 Profile* profile; | 46 Profile* profile; |
49 if (UserManager::Get()->user_is_logged_in()) { | 47 if (UserManager::Get()->user_is_logged_in()) { |
50 Browser* browser = BrowserList::GetLastActive(); | 48 Browser* browser = BrowserList::GetLastActive(); |
51 DCHECK(browser); | 49 DCHECK(browser); |
52 profile = browser->profile(); | 50 profile = browser->profile(); |
53 } else { | 51 } else { |
54 profile = ProfileManager::GetDefaultProfile(); | 52 profile = ProfileManager::GetDefaultProfile(); |
55 } | 53 } |
56 HtmlDialogView* html_view = | 54 HtmlDialogView* html_view = |
57 new HtmlDialogView(profile, new SimDialogDelegate(mode)); | 55 new HtmlDialogView(profile, new SimDialogDelegate(mode)); |
58 html_view->InitDialog(); | 56 browser::ShowHtmlDialog(owning_window, profile, html_view, STYLE_FLUSH); |
59 BubbleWindow::Create(owning_window, | |
60 STYLE_FLUSH, | |
61 html_view); | |
62 html_view->GetWidget()->Show(); | |
63 } | 57 } |
64 | 58 |
65 SimDialogDelegate::SimDialogDelegate(SimDialogMode dialog_mode) | 59 SimDialogDelegate::SimDialogDelegate(SimDialogMode dialog_mode) |
66 : dialog_mode_(dialog_mode) { | 60 : dialog_mode_(dialog_mode) { |
67 } | 61 } |
68 | 62 |
69 SimDialogDelegate::~SimDialogDelegate() { | 63 SimDialogDelegate::~SimDialogDelegate() { |
70 } | 64 } |
71 | 65 |
72 bool SimDialogDelegate::IsDialogModal() const { | 66 bool SimDialogDelegate::IsDialogModal() const { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 bool SimDialogDelegate::ShouldShowDialogTitle() const { | 116 bool SimDialogDelegate::ShouldShowDialogTitle() const { |
123 return false; | 117 return false; |
124 } | 118 } |
125 | 119 |
126 bool SimDialogDelegate::HandleContextMenu(const ContextMenuParams& params) { | 120 bool SimDialogDelegate::HandleContextMenu(const ContextMenuParams& params) { |
127 // Disable context menu. | 121 // Disable context menu. |
128 return true; | 122 return true; |
129 } | 123 } |
130 | 124 |
131 } // namespace chromeos | 125 } // namespace chromeos |
OLD | NEW |