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

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

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up some debug output. Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/time_formatting.h" 8 #include "base/i18n/time_formatting.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 DictionaryValue* GetNetworkInfoDict(const chromeos::Network* network) { 62 DictionaryValue* GetNetworkInfoDict(const chromeos::Network* network) {
63 DictionaryValue* item = new DictionaryValue; 63 DictionaryValue* item = new DictionaryValue;
64 item->SetString("name", network->name()); 64 item->SetString("name", network->name());
65 item->SetString("device_path", network->device_path()); 65 item->SetString("device_path", network->device_path());
66 item->SetString("ip_address", network->ip_address()); 66 item->SetString("ip_address", network->ip_address());
67 item->SetString("status", network->GetStateString()); 67 item->SetString("status", network->GetStateString());
68 return item; 68 return item;
69 } 69 }
70 70
71 Value* GetProxySetting(const std::string& setting_name) { 71 const Value* GetProxySetting(const std::string& setting_name) {
72 chromeos::ProxyCrosSettingsProvider settings_provider; 72 chromeos::ProxyCrosSettingsProvider settings_provider;
73 std::string setting_path = "cros.session.proxy."; 73 std::string setting_path = "cros.session.proxy.";
74 setting_path.append(setting_name); 74 setting_path.append(setting_name);
75 75
76 if (setting_name == "ignorelist") { 76 return settings_provider.Get(setting_path);
77 Value* value;
78 if (settings_provider.Get(setting_path, &value))
79 return value;
80 } else {
81 Value* setting;
82 if (settings_provider.Get(setting_path, &setting)) {
83 DictionaryValue* setting_dict = static_cast<DictionaryValue*>(setting);
84 Value* value;
85 bool found = setting_dict->Remove("value", &value);
86 delete setting;
87 if (found)
88 return value;
89 }
90 }
91 return NULL;
92 } 77 }
93 78
94 const char* UpdateStatusToString(chromeos::UpdateStatusOperation status) { 79 const char* UpdateStatusToString(chromeos::UpdateStatusOperation status) {
95 switch (status) { 80 switch (status) {
96 case chromeos::UPDATE_STATUS_IDLE: 81 case chromeos::UPDATE_STATUS_IDLE:
97 return "idle"; 82 return "idle";
98 case chromeos::UPDATE_STATUS_CHECKING_FOR_UPDATE: 83 case chromeos::UPDATE_STATUS_CHECKING_FOR_UPDATE:
99 return "checking for update"; 84 return "checking for update";
100 case chromeos::UPDATE_STATUS_UPDATE_AVAILABLE: 85 case chromeos::UPDATE_STATUS_UPDATE_AVAILABLE:
101 return "update available"; 86 return "update available";
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 IPC::Message* reply_message) { 506 IPC::Message* reply_message) {
522 const char* settings[] = { "pacurl", "singlehttp", "singlehttpport", 507 const char* settings[] = { "pacurl", "singlehttp", "singlehttpport",
523 "httpurl", "httpport", "httpsurl", "httpsport", 508 "httpurl", "httpport", "httpsurl", "httpsport",
524 "type", "single", "ftpurl", "ftpport", 509 "type", "single", "ftpurl", "ftpport",
525 "socks", "socksport", "ignorelist" }; 510 "socks", "socksport", "ignorelist" };
526 511
527 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 512 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
528 chromeos::ProxyCrosSettingsProvider settings_provider; 513 chromeos::ProxyCrosSettingsProvider settings_provider;
529 514
530 for (size_t i = 0; i < arraysize(settings); ++i) { 515 for (size_t i = 0; i < arraysize(settings); ++i) {
531 Value* setting = GetProxySetting(settings[i]); 516 const Value* setting = GetProxySetting(settings[i]);
532 if (setting) 517 if (setting)
533 return_value->Set(settings[i], setting); 518 return_value->Set(settings[i], setting->DeepCopy());
534 } 519 }
535 520
536 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); 521 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
537 } 522 }
538 523
539 void TestingAutomationProvider::SetProxySettings(DictionaryValue* args, 524 void TestingAutomationProvider::SetProxySettings(DictionaryValue* args,
540 IPC::Message* reply_message) { 525 IPC::Message* reply_message) {
541 AutomationJSONReply reply(this, reply_message); 526 AutomationJSONReply reply(this, reply_message);
542 std::string key; 527 std::string key;
543 Value* value; 528 Value* value;
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 1121
1137 // Set up an observer (it will delete itself). 1122 // Set up an observer (it will delete itself).
1138 take_photo_dialog->AddObserver(new PhotoCaptureObserver( 1123 take_photo_dialog->AddObserver(new PhotoCaptureObserver(
1139 this, reply_message)); 1124 this, reply_message));
1140 1125
1141 views::Widget* window = browser::CreateViewsWindow( 1126 views::Widget* window = browser::CreateViewsWindow(
1142 browser->window()->GetNativeHandle(), take_photo_dialog); 1127 browser->window()->GetNativeHandle(), take_photo_dialog);
1143 window->SetAlwaysOnTop(true); 1128 window->SetAlwaysOnTop(true);
1144 window->Show(); 1129 window->Show();
1145 } 1130 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main.cc » ('j') | chrome/browser/chromeos/cros/network_library.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698