OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/app_mode/startup_app_launcher.h" | 5 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 | 119 |
120 // static. | 120 // static. |
121 void StartupAppLauncher::LoadOAuthFileOnBlockingPool( | 121 void StartupAppLauncher::LoadOAuthFileOnBlockingPool( |
122 KioskOAuthParams* auth_params) { | 122 KioskOAuthParams* auth_params) { |
123 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; | 123 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; |
124 std::string error_msg; | 124 std::string error_msg; |
125 base::FilePath user_data_dir; | 125 base::FilePath user_data_dir; |
126 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 126 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
127 base::FilePath auth_file = user_data_dir.Append(kOAuthFileName); | 127 base::FilePath auth_file = user_data_dir.Append(kOAuthFileName); |
128 scoped_ptr<JSONFileValueDeserializer> deserializer( | 128 std::unique_ptr<JSONFileValueDeserializer> deserializer( |
129 new JSONFileValueDeserializer(user_data_dir.Append(kOAuthFileName))); | 129 new JSONFileValueDeserializer(user_data_dir.Append(kOAuthFileName))); |
130 scoped_ptr<base::Value> value = | 130 std::unique_ptr<base::Value> value = |
131 deserializer->Deserialize(&error_code, &error_msg); | 131 deserializer->Deserialize(&error_code, &error_msg); |
132 base::DictionaryValue* dict = NULL; | 132 base::DictionaryValue* dict = NULL; |
133 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || | 133 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || |
134 !value.get() || !value->GetAsDictionary(&dict)) { | 134 !value.get() || !value->GetAsDictionary(&dict)) { |
135 LOG(WARNING) << "Can't find auth file at " << auth_file.value(); | 135 LOG(WARNING) << "Can't find auth file at " << auth_file.value(); |
136 return; | 136 return; |
137 } | 137 } |
138 | 138 |
139 dict->GetString(kOAuthRefreshToken, &auth_params->refresh_token); | 139 dict->GetString(kOAuthRefreshToken, &auth_params->refresh_token); |
140 dict->GetString(kOAuthClientId, &auth_params->client_id); | 140 dict->GetString(kOAuthClientId, &auth_params->client_id); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 UpdateAppData(); | 539 UpdateAppData(); |
540 delegate_->OnReadyToLaunch(); | 540 delegate_->OnReadyToLaunch(); |
541 } | 541 } |
542 | 542 |
543 void StartupAppLauncher::UpdateAppData() { | 543 void StartupAppLauncher::UpdateAppData() { |
544 KioskAppManager::Get()->ClearAppData(app_id_); | 544 KioskAppManager::Get()->ClearAppData(app_id_); |
545 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 545 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
546 } | 546 } |
547 | 547 |
548 } // namespace chromeos | 548 } // namespace chromeos |
OLD | NEW |