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

Side by Side Diff: chrome/browser/ui/ash/system_tray_common.cc

Issue 2373863002: mustash: Connect ash system tray "show settings" items to chrome over mojo (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 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_common.h" 5 #include "chrome/browser/ui/ash/system_tray_common.h"
6 6
7 #include "base/logging.h"
8 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
9 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
7 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
8 #include "chrome/browser/ui/chrome_pages.h" 11 #include "chrome/browser/ui/chrome_pages.h"
12 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
13 #include "chrome/browser/ui/singleton_tabs.h"
9 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
10 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
16 #include "chromeos/login/login_state.h"
11 #include "content/public/browser/user_metrics.h" 17 #include "content/public/browser/user_metrics.h"
12 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
13 19
20 using chromeos::LoginState;
21
22 namespace {
23
24 const char kPaletteSettingsSubPageName[] = "stylus-overlay";
25
26 void ShowSettingsSubPageForActiveUser(const std::string& sub_page) {
27 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(),
28 sub_page);
29 }
30
31 } // namespace
32
33 // static
34 const char SystemTrayCommon::kDisplaySettingsSubPageName[] = "display";
35 const char SystemTrayCommon::kDisplayOverscanSettingsSubPageName[] =
36 "displayOverscan";
37
38 // static
39 void SystemTrayCommon::ShowSettings() {
40 ShowSettingsSubPageForActiveUser("");
msw 2016/09/27 20:14:34 nit: s/""/std::string()/
James Cook 2016/09/27 20:48:59 Done.
41 }
42
14 // static 43 // static
15 void SystemTrayCommon::ShowDateSettings() { 44 void SystemTrayCommon::ShowDateSettings() {
16 content::RecordAction(base::UserMetricsAction("ShowDateOptions")); 45 content::RecordAction(base::UserMetricsAction("ShowDateOptions"));
17 std::string sub_page = 46 std::string sub_page =
18 std::string(chrome::kSearchSubPage) + "#" + 47 std::string(chrome::kSearchSubPage) + "#" +
19 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); 48 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME);
20 // Everybody can change the time zone (even though it is a device setting). 49 // Everybody can change the time zone (even though it is a device setting).
21 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), 50 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(),
22 sub_page); 51 sub_page);
23 } 52 }
53
54 // static
55 void SystemTrayCommon::ShowDisplaySettings() {
56 content::RecordAction(base::UserMetricsAction("ShowDisplayOptions"));
57 ShowSettingsSubPageForActiveUser(kDisplaySettingsSubPageName);
58 }
59
60 // static
61 void SystemTrayCommon::ShowChromeSlow() {
62 chrome::ScopedTabbedBrowserDisplayer displayer(
63 ProfileManager::GetPrimaryUserProfile());
64 chrome::ShowSlow(displayer.browser());
65 }
66
67 // static
68 void SystemTrayCommon::ShowIMESettings() {
69 content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog"));
70 ShowSettingsSubPageForActiveUser(chrome::kLanguageOptionsSubPage);
71 }
72
73 // static
74 void SystemTrayCommon::ShowHelp() {
75 chrome::ShowHelpForProfile(ProfileManager::GetActiveUserProfile(),
76 chrome::HELP_SOURCE_MENU);
77 }
78
79 // static
80 void SystemTrayCommon::ShowAccessibilityHelp() {
81 chrome::ScopedTabbedBrowserDisplayer displayer(
82 ProfileManager::GetActiveUserProfile());
83 chromeos::accessibility::ShowAccessibilityHelp(displayer.browser());
84 }
85
86 // static
87 void SystemTrayCommon::ShowAccessibilitySettings() {
88 content::RecordAction(base::UserMetricsAction("ShowAccessibilitySettings"));
89 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" +
90 l10n_util::GetStringUTF8(
91 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY);
92 ShowSettingsSubPageForActiveUser(sub_page);
93 }
94
95 // static
96 void SystemTrayCommon::ShowPaletteHelp() {
97 chrome::ScopedTabbedBrowserDisplayer displayer(
98 ProfileManager::GetActiveUserProfile());
99 chrome::ShowSingletonTab(displayer.browser(),
100 GURL(chrome::kChromePaletteHelpURL));
101 }
102
103 // static
104 void SystemTrayCommon::ShowPaletteSettings() {
105 content::RecordAction(base::UserMetricsAction("ShowPaletteOptions"));
106 ShowSettingsSubPageForActiveUser(kPaletteSettingsSubPageName);
107 }
108
109 // static
110 void SystemTrayCommon::ShowPublicAccountInfo() {
111 chrome::ScopedTabbedBrowserDisplayer displayer(
112 ProfileManager::GetActiveUserProfile());
113 chrome::ShowPolicy(displayer.browser());
114 }
115
116 // static
117 void SystemTrayCommon::ShowProxySettings() {
118 LoginState* login_state = LoginState::Get();
119 // User is not logged in.
120 CHECK(!login_state->IsUserLoggedIn() ||
121 login_state->GetLoggedInUserType() == LoginState::LOGGED_IN_USER_NONE);
122 chromeos::LoginDisplayHost::default_host()->OpenProxySettings();
123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698