OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/ash/system_tray_client.h" | 5 #include "chrome/browser/ui/ash/system_tray_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_process_platform_part.h" | 10 #include "chrome/browser/browser_process_platform_part.h" |
11 #include "chrome/browser/chromeos/system/system_clock.h" | 11 #include "chrome/browser/chromeos/system/system_clock.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/ui/chrome_pages.h" |
12 #include "chrome/browser/ui/ash/system_tray_common.h" | 14 #include "chrome/browser/ui/ash/system_tray_common.h" |
| 15 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/grit/generated_resources.h" |
13 #include "content/public/common/mojo_shell_connection.h" | 17 #include "content/public/common/mojo_shell_connection.h" |
14 #include "services/shell/public/cpp/connector.h" | 18 #include "services/shell/public/cpp/connector.h" |
| 19 #include "content/public/browser/user_metrics.h" |
| 20 #include "ui/base/l10n/l10n_util.h" |
15 | 21 |
16 namespace { | 22 namespace { |
17 | 23 |
18 SystemTrayClient* g_instance = nullptr; | 24 SystemTrayClient* g_instance = nullptr; |
19 | 25 |
20 } // namespace | 26 } // namespace |
21 | 27 |
22 SystemTrayClient::SystemTrayClient() { | 28 SystemTrayClient::SystemTrayClient() { |
23 // If this observes clock setting changes before ash comes up the IPCs will | 29 // If this observes clock setting changes before ash comes up the IPCs will |
24 // be queued on |system_tray_|. | 30 // be queued on |system_tray_|. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 64 } |
59 | 65 |
60 //////////////////////////////////////////////////////////////////////////////// | 66 //////////////////////////////////////////////////////////////////////////////// |
61 // ash::mojom::SystemTrayClient: | 67 // ash::mojom::SystemTrayClient: |
62 | 68 |
63 void SystemTrayClient::ShowSettings() { | 69 void SystemTrayClient::ShowSettings() { |
64 SystemTrayCommon::ShowSettings(); | 70 SystemTrayCommon::ShowSettings(); |
65 } | 71 } |
66 | 72 |
67 void SystemTrayClient::ShowDateSettings() { | 73 void SystemTrayClient::ShowDateSettings() { |
68 SystemTrayCommon::ShowDateSettings(); | 74 // REVIEWERS: SystemTrayCommon is not needed with this approach. |
| 75 content::RecordAction(base::UserMetricsAction("ShowDateOptions")); |
| 76 std::string sub_page = |
| 77 std::string(chrome::kSearchSubPage) + "#" + |
| 78 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); |
| 79 // Everybody can change the time zone (even though it is a device setting). |
| 80 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), |
| 81 sub_page); |
69 } | 82 } |
70 | 83 |
71 void SystemTrayClient::ShowDisplaySettings() { | 84 void SystemTrayClient::ShowDisplaySettings() { |
72 SystemTrayCommon::ShowDisplaySettings(); | 85 SystemTrayCommon::ShowDisplaySettings(); |
73 } | 86 } |
74 | 87 |
75 void SystemTrayClient::ShowChromeSlow() { | 88 void SystemTrayClient::ShowChromeSlow() { |
76 SystemTrayCommon::ShowChromeSlow(); | 89 SystemTrayCommon::ShowChromeSlow(); |
77 } | 90 } |
78 | 91 |
(...skipping 30 matching lines...) Expand all Loading... |
109 } | 122 } |
110 | 123 |
111 //////////////////////////////////////////////////////////////////////////////// | 124 //////////////////////////////////////////////////////////////////////////////// |
112 // chromeos::system::SystemClockObserver: | 125 // chromeos::system::SystemClockObserver: |
113 | 126 |
114 void SystemTrayClient::OnSystemClockChanged( | 127 void SystemTrayClient::OnSystemClockChanged( |
115 chromeos::system::SystemClock* clock) { | 128 chromeos::system::SystemClock* clock) { |
116 ConnectToSystemTray(); | 129 ConnectToSystemTray(); |
117 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 130 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
118 } | 131 } |
OLD | NEW |