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

Side by Side Diff: chrome/browser/interstitials/chrome_controller_client.cc

Issue 2459193003: Open ChromeOS clock settings on the UI thread instead of File. (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/interstitials/chrome_controller_client.h" 5 #include "chrome/browser/interstitials/chrome_controller_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/process/launch.h" 10 #include "base/process/launch.h"
(...skipping 24 matching lines...) Expand all
35 #include "base/base_paths_win.h" 35 #include "base/base_paths_win.h"
36 #include "base/path_service.h" 36 #include "base/path_service.h"
37 #include "base/strings/string16.h" 37 #include "base/strings/string16.h"
38 #include "base/win/windows_version.h" 38 #include "base/win/windows_version.h"
39 #endif 39 #endif
40 40
41 using content::Referrer; 41 using content::Referrer;
42 42
43 namespace { 43 namespace {
44 44
45 void LaunchDateAndTimeSettingsOnFile() { 45 void LaunchDateAndTimeSettingsOnFileThread() {
46 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); 46 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
47 // The code for each OS is completely separate, in order to avoid bugs like 47 // The code for each OS is completely separate, in order to avoid bugs like
48 // https://crbug.com/430877 . 48 // https://crbug.com/430877 . ChromeOS is handled on the UI thread.
49 #if defined(OS_ANDROID) 49 #if defined(OS_ANDROID)
50 chrome::android::OpenDateAndTimeSettings(); 50 chrome::android::OpenDateAndTimeSettings();
estark 2016/10/31 19:02:49 I wonder if this should be on the UI thread as wel
meacer 2016/10/31 21:38:22 Yeah, I was wondering the same thing. I don't kn
51 51
52 #elif defined(OS_CHROMEOS)
53 std::string sub_page =
54 std::string(chrome::kSearchSubPage) + "#" +
55 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME);
56 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(),
57 sub_page);
58
59 #elif defined(OS_LINUX) 52 #elif defined(OS_LINUX)
60 struct ClockCommand { 53 struct ClockCommand {
61 const char* pathname; 54 const char* const pathname;
62 const char* argument; 55 const char* const argument;
63 }; 56 };
64 static const ClockCommand kClockCommands[] = { 57 static const ClockCommand kClockCommands[] = {
65 // Unity 58 // Unity
66 {"/usr/bin/unity-control-center", "datetime"}, 59 {"/usr/bin/unity-control-center", "datetime"},
67 // GNOME 60 // GNOME
68 // 61 //
69 // NOTE: On old Ubuntu, naming control panels doesn't work, so it 62 // NOTE: On old Ubuntu, naming control panels doesn't work, so it
70 // opens the overview. This will have to be good enough. 63 // opens the overview. This will have to be good enough.
71 {"/usr/bin/gnome-control-center", "datetime"}, 64 {"/usr/bin/gnome-control-center", "datetime"},
72 {"/usr/local/bin/gnome-control-center", "datetime"}, 65 {"/usr/local/bin/gnome-control-center", "datetime"},
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 bool ChromeControllerClient::CanLaunchDateAndTimeSettings() { 136 bool ChromeControllerClient::CanLaunchDateAndTimeSettings() {
144 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_LINUX) || \ 137 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_LINUX) || \
145 defined(OS_MACOSX) || defined(OS_WIN) 138 defined(OS_MACOSX) || defined(OS_WIN)
146 return true; 139 return true;
147 #else 140 #else
148 return false; 141 return false;
149 #endif 142 #endif
150 } 143 }
151 144
152 void ChromeControllerClient::LaunchDateAndTimeSettings() { 145 void ChromeControllerClient::LaunchDateAndTimeSettings() {
146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
147
148 #if defined(OS_CHROMEOS)
149 const std::string sub_page =
150 std::string(chrome::kSearchSubPage) + "#" +
151 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME);
152 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(),
153 sub_page);
154 #else
153 content::BrowserThread::PostTask( 155 content::BrowserThread::PostTask(
154 content::BrowserThread::FILE, FROM_HERE, 156 content::BrowserThread::FILE, FROM_HERE,
155 base::Bind(&LaunchDateAndTimeSettingsOnFile)); 157 base::Bind(&LaunchDateAndTimeSettingsOnFileThread));
158 #endif
156 } 159 }
157 160
158 void ChromeControllerClient::GoBack() { 161 void ChromeControllerClient::GoBack() {
159 interstitial_page_->DontProceed(); 162 interstitial_page_->DontProceed();
160 } 163 }
161 164
162 void ChromeControllerClient::Proceed() { 165 void ChromeControllerClient::Proceed() {
163 interstitial_page_->Proceed(); 166 interstitial_page_->Proceed();
164 } 167 }
165 168
(...skipping 14 matching lines...) Expand all
180 183
181 PrefService* ChromeControllerClient::GetPrefService() { 184 PrefService* ChromeControllerClient::GetPrefService() {
182 Profile* profile = 185 Profile* profile =
183 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 186 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
184 return profile->GetPrefs(); 187 return profile->GetPrefs();
185 } 188 }
186 189
187 const std::string ChromeControllerClient::GetExtendedReportingPrefName() { 190 const std::string ChromeControllerClient::GetExtendedReportingPrefName() {
188 return prefs::kSafeBrowsingExtendedReportingEnabled; 191 return prefs::kSafeBrowsingExtendedReportingEnabled;
189 } 192 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698