Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: chrome/browser/chromeos/set_time_dialog.cc

Issue 2441133002: mash: Introduce ShowWebDialogWithContainer for webui dialogs (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/set_time_dialog.h" 5 #include "chrome/browser/chromeos/set_time_dialog.h"
6 6
7 #include "ash/public/cpp/shell_window_ids.h"
7 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
8 #include "chrome/browser/ui/browser_dialogs.h" 9 #include "chrome/browser/ui/ash/web_dialog_util.h"
9 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/user_metrics.h" 11 #include "content/public/browser/user_metrics.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 13
13 using content::WebContents; 14 using content::WebContents;
14 using content::WebUIMessageHandler; 15 using content::WebUIMessageHandler;
15 16
16 namespace chromeos { 17 namespace chromeos {
17 18
18 namespace { 19 namespace {
19 20
20 const int kDefaultWidth = 490; 21 const int kDefaultWidth = 490;
21 const int kDefaultHeight = 235; 22 const int kDefaultHeight = 235;
22 23
24 void ShowDialog(gfx::NativeWindow parent, int container_id) {
25 DCHECK(parent || container_id != ash::kShellWindowId_Invalid);
26 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show"));
27 chrome::ShowWebDialogWithContainer(parent, container_id,
28 ProfileManager::GetActiveUserProfile(),
29 new SetTimeDialog());
30 }
31
23 } // namespace 32 } // namespace
24 33
25 // static 34 // static
26 void SetTimeDialog::ShowDialog(gfx::NativeWindow owning_window) { 35 void SetTimeDialog::ShowDialogInParent(gfx::NativeWindow parent) {
27 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show")); 36 DCHECK(parent);
28 chrome::ShowWebDialog(owning_window, 37 ShowDialog(parent, ash::kShellWindowId_Invalid);
29 ProfileManager::GetActiveUserProfile(), 38 }
30 new SetTimeDialog()); 39
40 // static
41 void SetTimeDialog::ShowDialogInContainer(int container_id) {
42 DCHECK(container_id != ash::kShellWindowId_Invalid);
43 ShowDialog(nullptr, container_id);
31 } 44 }
32 45
33 SetTimeDialog::SetTimeDialog() { 46 SetTimeDialog::SetTimeDialog() {
34 } 47 }
35 48
36 SetTimeDialog::~SetTimeDialog() { 49 SetTimeDialog::~SetTimeDialog() {
37 } 50 }
38 51
39 ui::ModalType SetTimeDialog::GetDialogModalType() const { 52 ui::ModalType SetTimeDialog::GetDialogModalType() const {
40 return ui::MODAL_TYPE_SYSTEM; 53 return ui::MODAL_TYPE_SYSTEM;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return false; 86 return false;
74 } 87 }
75 88
76 bool SetTimeDialog::HandleContextMenu( 89 bool SetTimeDialog::HandleContextMenu(
77 const content::ContextMenuParams& params) { 90 const content::ContextMenuParams& params) {
78 // Disable context menu. 91 // Disable context menu.
79 return true; 92 return true;
80 } 93 }
81 94
82 } // namespace chromeos 95 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698