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/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/login/user_manager.h" | 8 #include "chrome/browser/chromeos/login/user_manager.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/ui/views/web_dialog_view.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
12 #include "ui/views/view.h" | 12 #include "ui/gfx/size.h" |
13 #include "ui/views/widget/widget.h" | |
14 | 13 |
15 using content::WebContents; | 14 using content::WebContents; |
16 using content::WebUIMessageHandler; | 15 using content::WebUIMessageHandler; |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 // Default width/height of the dialog. | 19 // Default width/height of the dialog. |
21 const int kDefaultWidth = 350; | 20 const int kDefaultWidth = 350; |
22 const int kDefaultHeight = 225; | 21 const int kDefaultHeight = 225; |
23 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
38 const char kSimDialogSetLockOnMode[] = "set-lock-on"; | 37 const char kSimDialogSetLockOnMode[] = "set-lock-on"; |
39 const char kSimDialogSetLockOffMode[] = "set-lock-off"; | 38 const char kSimDialogSetLockOffMode[] = "set-lock-off"; |
40 | 39 |
41 } // namespace | 40 } // namespace |
42 | 41 |
43 namespace chromeos { | 42 namespace chromeos { |
44 | 43 |
45 // static | 44 // static |
46 void SimDialogDelegate::ShowDialog(gfx::NativeWindow owning_window, | 45 void SimDialogDelegate::ShowDialog(gfx::NativeWindow owning_window, |
47 SimDialogMode mode) { | 46 SimDialogMode mode) { |
48 views::Widget::CreateWindowWithParent( | 47 chrome::ShowWebDialog(owning_window, |
49 new WebDialogView(ProfileManager::GetDefaultProfileOrOffTheRecord(), | 48 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
50 new SimDialogDelegate(mode)), | 49 new SimDialogDelegate(mode)); |
51 owning_window)->Show(); | |
52 } | 50 } |
53 | 51 |
54 SimDialogDelegate::SimDialogDelegate(SimDialogMode dialog_mode) | 52 SimDialogDelegate::SimDialogDelegate(SimDialogMode dialog_mode) |
55 : dialog_mode_(dialog_mode) { | 53 : dialog_mode_(dialog_mode) { |
56 } | 54 } |
57 | 55 |
58 SimDialogDelegate::~SimDialogDelegate() { | 56 SimDialogDelegate::~SimDialogDelegate() { |
59 } | 57 } |
60 | 58 |
61 ui::ModalType SimDialogDelegate::GetDialogModalType() const { | 59 ui::ModalType SimDialogDelegate::GetDialogModalType() const { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return false; | 110 return false; |
113 } | 111 } |
114 | 112 |
115 bool SimDialogDelegate::HandleContextMenu( | 113 bool SimDialogDelegate::HandleContextMenu( |
116 const content::ContextMenuParams& params) { | 114 const content::ContextMenuParams& params) { |
117 // Disable context menu. | 115 // Disable context menu. |
118 return true; | 116 return true; |
119 } | 117 } |
120 | 118 |
121 } // namespace chromeos | 119 } // namespace chromeos |
OLD | NEW |