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

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

Issue 2441133002: mash: Introduce ShowWebDialogWithContainer for webui dialogs (Closed)
Patch Set: review comments Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/set_time_dialog.h ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
23 } // namespace 24 } // namespace
24 25
25 // static 26 // static
26 void SetTimeDialog::ShowDialog(gfx::NativeWindow owning_window) { 27 void SetTimeDialog::ShowDialogInParent(gfx::NativeWindow parent) {
27 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show")); 28 DCHECK(parent);
28 chrome::ShowWebDialog(owning_window, 29 ShowDialogImpl(parent, ash::kShellWindowId_Invalid);
29 ProfileManager::GetActiveUserProfile(), 30 }
30 new SetTimeDialog()); 31
32 // static
33 void SetTimeDialog::ShowDialogInContainer(int container_id) {
34 DCHECK_NE(container_id, ash::kShellWindowId_Invalid);
35 ShowDialogImpl(nullptr, container_id);
31 } 36 }
32 37
33 SetTimeDialog::SetTimeDialog() { 38 SetTimeDialog::SetTimeDialog() {
34 } 39 }
35 40
36 SetTimeDialog::~SetTimeDialog() { 41 SetTimeDialog::~SetTimeDialog() {
37 } 42 }
38 43
44 // static
45 void SetTimeDialog::ShowDialogImpl(gfx::NativeWindow parent, int container_id) {
46 DCHECK(parent || container_id != ash::kShellWindowId_Invalid);
47 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show"));
48 chrome::ShowWebDialogWithContainer(parent, container_id,
49 ProfileManager::GetActiveUserProfile(),
50 new SetTimeDialog());
51 }
52
39 ui::ModalType SetTimeDialog::GetDialogModalType() const { 53 ui::ModalType SetTimeDialog::GetDialogModalType() const {
40 return ui::MODAL_TYPE_SYSTEM; 54 return ui::MODAL_TYPE_SYSTEM;
41 } 55 }
42 56
43 base::string16 SetTimeDialog::GetDialogTitle() const { 57 base::string16 SetTimeDialog::GetDialogTitle() const {
44 return base::string16(); 58 return base::string16();
45 } 59 }
46 60
47 GURL SetTimeDialog::GetDialogContentURL() const { 61 GURL SetTimeDialog::GetDialogContentURL() const {
48 return GURL(chrome::kChromeUISetTimeURL); 62 return GURL(chrome::kChromeUISetTimeURL);
(...skipping 24 matching lines...) Expand all
73 return false; 87 return false;
74 } 88 }
75 89
76 bool SetTimeDialog::HandleContextMenu( 90 bool SetTimeDialog::HandleContextMenu(
77 const content::ContextMenuParams& params) { 91 const content::ContextMenuParams& params) {
78 // Disable context menu. 92 // Disable context menu.
79 return true; 93 return true;
80 } 94 }
81 95
82 } // namespace chromeos 96 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/set_time_dialog.h ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698