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

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

Issue 2446573003: chromeos: Make "mobile network" and "set time" dialogs work with mash (Closed)
Patch Set: cleanup 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
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 "ash/public/cpp/shell_window_ids.h"
8 #include "chrome/browser/profiles/profile_manager.h" 8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/ui/ash/web_dialog_util.h" 9 #include "chrome/browser/ui/ash/web_dialog_util.h"
10 #include "chrome/browser/ui/browser_dialogs.h"
10 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
11 #include "content/public/browser/user_metrics.h" 12 #include "content/public/browser/user_metrics.h"
12 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
13 14
14 using content::WebContents; 15 using content::WebContents;
15 using content::WebUIMessageHandler; 16 using content::WebUIMessageHandler;
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 namespace { 20 namespace {
20 21
21 const int kDefaultWidth = 490; 22 const int kDefaultWidth = 490;
22 const int kDefaultHeight = 235; 23 const int kDefaultHeight = 235;
23 24
24 } // namespace 25 } // namespace
25 26
26 // static 27 // static
27 void SetTimeDialog::ShowDialogInParent(gfx::NativeWindow parent) { 28 void SetTimeDialog::ShowDialogInParent(gfx::NativeWindow parent) {
28 DCHECK(parent); 29 DCHECK(parent);
29 ShowDialogImpl(parent, ash::kShellWindowId_Invalid); 30 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show"));
31 chrome::ShowWebDialog(parent, ProfileManager::GetActiveUserProfile(),
32 new SetTimeDialog());
30 } 33 }
31 34
32 // static 35 // static
33 void SetTimeDialog::ShowDialogInContainer(int container_id) { 36 void SetTimeDialog::ShowDialogInContainer(int container_id) {
34 DCHECK_NE(container_id, ash::kShellWindowId_Invalid); 37 DCHECK_NE(container_id, ash::kShellWindowId_Invalid);
35 ShowDialogImpl(nullptr, container_id); 38 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show"));
39 chrome::ShowWebDialogInContainer(container_id,
40 ProfileManager::GetActiveUserProfile(),
41 new SetTimeDialog());
36 } 42 }
37 43
38 SetTimeDialog::SetTimeDialog() { 44 SetTimeDialog::SetTimeDialog() {
39 } 45 }
40 46
41 SetTimeDialog::~SetTimeDialog() { 47 SetTimeDialog::~SetTimeDialog() {
42 } 48 }
43 49
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
53 ui::ModalType SetTimeDialog::GetDialogModalType() const { 50 ui::ModalType SetTimeDialog::GetDialogModalType() const {
54 return ui::MODAL_TYPE_SYSTEM; 51 return ui::MODAL_TYPE_SYSTEM;
55 } 52 }
56 53
57 base::string16 SetTimeDialog::GetDialogTitle() const { 54 base::string16 SetTimeDialog::GetDialogTitle() const {
58 return base::string16(); 55 return base::string16();
59 } 56 }
60 57
61 GURL SetTimeDialog::GetDialogContentURL() const { 58 GURL SetTimeDialog::GetDialogContentURL() const {
62 return GURL(chrome::kChromeUISetTimeURL); 59 return GURL(chrome::kChromeUISetTimeURL);
(...skipping 24 matching lines...) Expand all
87 return false; 84 return false;
88 } 85 }
89 86
90 bool SetTimeDialog::HandleContextMenu( 87 bool SetTimeDialog::HandleContextMenu(
91 const content::ContextMenuParams& params) { 88 const content::ContextMenuParams& params) {
92 // Disable context menu. 89 // Disable context menu.
93 return true; 90 return true;
94 } 91 }
95 92
96 } // namespace chromeos 93 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698