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

Side by Side Diff: chrome/browser/automation/testing_automation_provider_chromeos.cc

Issue 10829235: Revert r150536 - "Added a timezone policy and pyauto tests for it." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_delegate.h" 8 #include "ash/shell_delegate.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/chromeos/login/login_display_host.h" 27 #include "chrome/browser/chromeos/login/login_display_host.h"
28 #include "chrome/browser/chromeos/login/network_screen.h" 28 #include "chrome/browser/chromeos/login/network_screen.h"
29 #include "chrome/browser/chromeos/login/screen_locker.h" 29 #include "chrome/browser/chromeos/login/screen_locker.h"
30 #include "chrome/browser/chromeos/login/update_screen.h" 30 #include "chrome/browser/chromeos/login/update_screen.h"
31 #include "chrome/browser/chromeos/login/user_image_screen.h" 31 #include "chrome/browser/chromeos/login/user_image_screen.h"
32 #include "chrome/browser/chromeos/login/webui_login_display.h" 32 #include "chrome/browser/chromeos/login/webui_login_display.h"
33 #include "chrome/browser/chromeos/login/webui_login_display_host.h" 33 #include "chrome/browser/chromeos/login/webui_login_display_host.h"
34 #include "chrome/browser/chromeos/login/wizard_controller.h" 34 #include "chrome/browser/chromeos/login/wizard_controller.h"
35 #include "chrome/browser/chromeos/options/take_photo_dialog.h" 35 #include "chrome/browser/chromeos/options/take_photo_dialog.h"
36 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h" 36 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h"
37 #include "chrome/browser/chromeos/settings/cros_settings.h"
38 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
39 #include "chrome/browser/chromeos/system/timezone_settings.h" 37 #include "chrome/browser/chromeos/system/timezone_settings.h"
40 #include "chrome/browser/policy/browser_policy_connector.h" 38 #include "chrome/browser/policy/browser_policy_connector.h"
41 #include "chrome/browser/policy/cloud_policy_cache_base.h" 39 #include "chrome/browser/policy/cloud_policy_cache_base.h"
42 #include "chrome/browser/policy/cloud_policy_data_store.h" 40 #include "chrome/browser/policy/cloud_policy_data_store.h"
43 #include "chrome/browser/policy/cloud_policy_subsystem.h" 41 #include "chrome/browser/policy/cloud_policy_subsystem.h"
44 #include "chrome/browser/policy/enterprise_install_attributes.h" 42 #include "chrome/browser/policy/enterprise_install_attributes.h"
45 #include "chrome/browser/prefs/pref_service.h" 43 #include "chrome/browser/prefs/pref_service.h"
46 #include "chrome/browser/ui/browser.h" 44 #include "chrome/browser/ui/browser.h"
47 #include "chrome/browser/ui/browser_window.h" 45 #include "chrome/browser/ui/browser_window.h"
48 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 46 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 DictionaryValue* args, 1307 DictionaryValue* args,
1310 IPC::Message* reply_message) { 1308 IPC::Message* reply_message) {
1311 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 1309 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
1312 base::Time time(base::Time::Now()); 1310 base::Time time(base::Time::Now());
1313 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean( 1311 bool use_24hour_clock = browser && browser->profile()->GetPrefs()->GetBoolean(
1314 prefs::kUse24HourClock); 1312 prefs::kUse24HourClock);
1315 base::HourClockType hour_clock_type = 1313 base::HourClockType hour_clock_type =
1316 use_24hour_clock ? base::k24HourClock : base::k12HourClock; 1314 use_24hour_clock ? base::k24HourClock : base::k12HourClock;
1317 string16 display_time = base::TimeFormatTimeOfDayWithHourClockType( 1315 string16 display_time = base::TimeFormatTimeOfDayWithHourClockType(
1318 time, hour_clock_type, base::kDropAmPm); 1316 time, hour_clock_type, base::kDropAmPm);
1319 string16 timezone = 1317 icu::UnicodeString unicode;
1320 chromeos::system::TimezoneSettings::GetInstance()->GetCurrentTimezoneID(); 1318 chromeos::system::TimezoneSettings::GetInstance()->GetTimezone().getID(
1319 unicode);
1320 std::string timezone;
1321 UTF16ToUTF8(unicode.getBuffer(), unicode.length(), &timezone);
1321 return_value->SetString("display_time", display_time); 1322 return_value->SetString("display_time", display_time);
1322 return_value->SetString("display_date", base::TimeFormatFriendlyDate(time)); 1323 return_value->SetString("display_date", base::TimeFormatFriendlyDate(time));
1323 return_value->SetString("timezone", timezone); 1324 return_value->SetString("timezone", timezone);
1324 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 1325 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
1325 } 1326 }
1326 1327
1327 void TestingAutomationProvider::GetTimeInfo(DictionaryValue* args, 1328 void TestingAutomationProvider::GetTimeInfo(DictionaryValue* args,
1328 IPC::Message* reply_message) { 1329 IPC::Message* reply_message) {
1329 GetTimeInfo(NULL, args, reply_message); 1330 GetTimeInfo(NULL, args, reply_message);
1330 } 1331 }
1331 1332
1332 void TestingAutomationProvider::SetTimezone(DictionaryValue* args, 1333 void TestingAutomationProvider::SetTimezone(DictionaryValue* args,
1333 IPC::Message* reply_message) { 1334 IPC::Message* reply_message) {
1334 AutomationJSONReply reply(this, reply_message);
1335 std::string timezone_id; 1335 std::string timezone_id;
1336 if (!args->GetString("timezone", &timezone_id)) { 1336 if (!args->GetString("timezone", &timezone_id)) {
1337 reply.SendError("Invalid or missing args."); 1337 AutomationJSONReply(this, reply_message).SendError(
1338 "Invalid or missing args.");
1338 return; 1339 return;
1339 } 1340 }
1340 chromeos::CrosSettings* settings = chromeos::CrosSettings::Get(); 1341
1341 settings->SetString(chromeos::kSystemTimezone, timezone_id); 1342 icu::TimeZone* timezone =
1342 reply.SendSuccess(NULL); 1343 icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(timezone_id));
1344 chromeos::system::TimezoneSettings::GetInstance()->SetTimezone(*timezone);
1345 delete timezone;
1346 AutomationJSONReply(this, reply_message).SendSuccess(NULL);
1343 } 1347 }
1344 1348
1345 void TestingAutomationProvider::GetUpdateInfo(DictionaryValue* args, 1349 void TestingAutomationProvider::GetUpdateInfo(DictionaryValue* args,
1346 IPC::Message* reply_message) { 1350 IPC::Message* reply_message) {
1347 AutomationJSONReply* reply = new AutomationJSONReply(this, reply_message); 1351 AutomationJSONReply* reply = new AutomationJSONReply(this, reply_message);
1348 DBusThreadManager::Get()->GetUpdateEngineClient() 1352 DBusThreadManager::Get()->GetUpdateEngineClient()
1349 ->GetReleaseTrack(base::Bind(GetReleaseTrackCallback, reply)); 1353 ->GetReleaseTrack(base::Bind(GetReleaseTrackCallback, reply));
1350 } 1354 }
1351 1355
1352 void TestingAutomationProvider::UpdateCheck( 1356 void TestingAutomationProvider::UpdateCheck(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance(); 1416 chromeos::AudioHandler* audio_handler = chromeos::AudioHandler::GetInstance();
1413 if (!audio_handler) { 1417 if (!audio_handler) {
1414 reply.SendError("AudioHandler not initialized."); 1418 reply.SendError("AudioHandler not initialized.");
1415 return; 1419 return;
1416 } 1420 }
1417 audio_handler->SetMuted(mute); 1421 audio_handler->SetMuted(mute);
1418 reply.SendSuccess(NULL); 1422 reply.SendSuccess(NULL);
1419 } 1423 }
1420 1424
1421 void TestingAutomationProvider::OpenCrosh(DictionaryValue* args, 1425 void TestingAutomationProvider::OpenCrosh(DictionaryValue* args,
1422 IPC::Message* reply_message) { 1426 IPC::Message* reply_message) {
1423 new NavigationNotificationObserver( 1427 new NavigationNotificationObserver(
1424 NULL, this, reply_message, 1, false, true); 1428 NULL, this, reply_message, 1, false, true);
1425 ash::Shell::GetInstance()->delegate()->OpenCrosh(); 1429 ash::Shell::GetInstance()->delegate()->OpenCrosh();
1426 } 1430 }
1427 1431
1428 void TestingAutomationProvider::CaptureProfilePhoto( 1432 void TestingAutomationProvider::CaptureProfilePhoto(
1429 Browser* browser, 1433 Browser* browser,
1430 DictionaryValue* args, 1434 DictionaryValue* args,
1431 IPC::Message* reply_message) { 1435 IPC::Message* reply_message) {
1432 chromeos::TakePhotoDialog* take_photo_dialog = 1436 chromeos::TakePhotoDialog* take_photo_dialog =
(...skipping 14 matching lines...) Expand all
1447 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 1451 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
1448 AddObserver(power_manager_observer_); 1452 AddObserver(power_manager_observer_);
1449 } 1453 }
1450 1454
1451 void TestingAutomationProvider::RemoveChromeosObservers() { 1455 void TestingAutomationProvider::RemoveChromeosObservers() {
1452 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 1456 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
1453 RemoveObserver(power_manager_observer_); 1457 RemoveObserver(power_manager_observer_);
1454 delete power_manager_observer_; 1458 delete power_manager_observer_;
1455 power_manager_observer_ = NULL; 1459 power_manager_observer_ = NULL;
1456 } 1460 }
OLDNEW
« no previous file with comments | « chrome/app/policy/policy_templates.json ('k') | chrome/browser/chromeos/settings/cros_settings_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698