Index: remoting/host/plugin/daemon_controller_mac.cc |
=================================================================== |
--- remoting/host/plugin/daemon_controller_mac.cc (revision 148248) |
+++ remoting/host/plugin/daemon_controller_mac.cc (working copy) |
@@ -37,12 +37,6 @@ |
// Therefore, we define the needed constants here. |
const int NSLibraryDirectory = 5; |
-// Use a single configuration file, instead of separate "auth" and "host" files. |
-// This is because the SetConfigAndStart() API only provides a single |
-// dictionary, and splitting this into two dictionaries would require |
-// knowledge of which keys belong in which files. |
-const char kHostConfigFile[] = kHostConfigDir kServiceName ".json"; |
- |
class DaemonControllerMac : public remoting::DaemonController { |
public: |
DaemonControllerMac(); |
@@ -104,12 +98,12 @@ |
CFNotificationCenterRemoveObserver( |
CFNotificationCenterGetDistributedCenter(), |
this, |
- CFSTR(kUpdateSucceededNotificationName), |
+ CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), |
NULL); |
CFNotificationCenterRemoveObserver( |
CFNotificationCenterGetDistributedCenter(), |
this, |
- CFSTR(kUpdateFailedNotificationName), |
+ CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), |
NULL); |
} |
@@ -180,7 +174,7 @@ |
} |
void DaemonControllerMac::DoGetConfig(const GetConfigCallback& callback) { |
- FilePath config_path(kHostConfigFile); |
+ FilePath config_path(kHostConfigFilePath); |
JsonHostConfig host_config(config_path); |
scoped_ptr<base::DictionaryValue> config; |
@@ -198,7 +192,7 @@ |
void DaemonControllerMac::DoGetVersion(const GetVersionCallback& callback) { |
std::string version = ""; |
- std::string command_line = remoting::kHostHelperTool; |
+ std::string command_line = remoting::kHostHelperScriptPath; |
command_line += " --host-version"; |
FILE* script_output = popen(command_line.c_str(), "r"); |
if (script_output) { |
@@ -231,7 +225,7 @@ |
void DaemonControllerMac::DoUpdateConfig( |
scoped_ptr<base::DictionaryValue> config, |
const CompletionCallback& done_callback) { |
- FilePath config_file_path(kHostConfigFile); |
+ FilePath config_file_path(kHostConfigFilePath); |
JsonHostConfig config_file(config_file_path); |
if (!config_file.Read()) { |
done_callback.Run(RESULT_FAILED); |
@@ -268,7 +262,7 @@ |
LOG(ERROR) << "Failed to get filename for saving configuration data."; |
return false; |
} |
- config_path = config_path.Append(kServiceName ".json"); |
+ config_path = config_path.Append(kHostConfigFileName); |
int written = file_util::WriteFile(config_path, config_data.data(), |
config_data.size()); |
@@ -286,8 +280,7 @@ |
LOG(ERROR) << "Failed to get directory for local preference panes."; |
return false; |
} |
- pane_path = pane_path.Append("PreferencePanes") |
- .Append(kServiceName ".prefPane"); |
+ pane_path = pane_path.Append("PreferencePanes").Append(kPrefPaneFileName); |
FSRef pane_path_ref; |
if (!base::mac::FSRefFromPath(pane_path.value(), &pane_path_ref)) { |
@@ -303,7 +296,10 @@ |
CFNotificationCenterRef center = |
CFNotificationCenterGetDistributedCenter(); |
- CFNotificationCenterPostNotification(center, CFSTR(kServiceName), NULL, NULL, |
+ base::mac::ScopedCFTypeRef<CFStringRef> service_name( |
+ CFStringCreateWithCString(kCFAllocatorDefault, remoting::kServiceName, |
+ kCFStringEncodingUTF8)); |
+ CFNotificationCenterPostNotification(center, service_name, NULL, NULL, |
TRUE); |
return true; |
} |
@@ -328,24 +324,24 @@ |
CFNotificationCenterGetDistributedCenter(), |
this, |
&DaemonControllerMac::PreferencePaneCallback, |
- CFSTR(kUpdateSucceededNotificationName), |
+ CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), |
NULL, |
CFNotificationSuspensionBehaviorDeliverImmediately); |
CFNotificationCenterAddObserver( |
CFNotificationCenterGetDistributedCenter(), |
this, |
&DaemonControllerMac::PreferencePaneCallback, |
- CFSTR(kUpdateFailedNotificationName), |
+ CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), |
NULL, |
CFNotificationSuspensionBehaviorDeliverImmediately); |
} |
void DaemonControllerMac::PreferencePaneCallbackDelegate(CFStringRef name) { |
AsyncResult result = RESULT_FAILED; |
- if (CFStringCompare(name, CFSTR(kUpdateSucceededNotificationName), 0) == |
+ if (CFStringCompare(name, CFSTR(UPDATE_SUCCEEDED_NOTIFICATION_NAME), 0) == |
kCFCompareEqualTo) { |
result = RESULT_OK; |
- } else if (CFStringCompare(name, CFSTR(kUpdateFailedNotificationName), 0) == |
+ } else if (CFStringCompare(name, CFSTR(UPDATE_FAILED_NOTIFICATION_NAME), 0) == |
kCFCompareEqualTo) { |
result = RESULT_FAILED; |
} else { |