| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // static. | 124 // static. |
| 125 void StartupAppLauncher::LoadOAuthFileOnBlockingPool( | 125 void StartupAppLauncher::LoadOAuthFileOnBlockingPool( |
| 126 KioskOAuthParams* auth_params) { | 126 KioskOAuthParams* auth_params) { |
| 127 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; | 127 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; |
| 128 std::string error_msg; | 128 std::string error_msg; |
| 129 base::FilePath user_data_dir; | 129 base::FilePath user_data_dir; |
| 130 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); | 130 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); |
| 131 base::FilePath auth_file = user_data_dir.Append(kOAuthFileName); | 131 base::FilePath auth_file = user_data_dir.Append(kOAuthFileName); |
| 132 scoped_ptr<JSONFileValueDeserializer> deserializer( | 132 scoped_ptr<JSONFileValueDeserializer> deserializer( |
| 133 new JSONFileValueDeserializer(user_data_dir.Append(kOAuthFileName))); | 133 new JSONFileValueDeserializer(user_data_dir.Append(kOAuthFileName))); |
| 134 scoped_ptr<base::Value> value( | 134 scoped_ptr<base::Value> value = |
| 135 deserializer->Deserialize(&error_code, &error_msg)); | 135 deserializer->Deserialize(&error_code, &error_msg); |
| 136 base::DictionaryValue* dict = NULL; | 136 base::DictionaryValue* dict = NULL; |
| 137 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || | 137 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || |
| 138 !value.get() || !value->GetAsDictionary(&dict)) { | 138 !value.get() || !value->GetAsDictionary(&dict)) { |
| 139 LOG(WARNING) << "Can't find auth file at " << auth_file.value(); | 139 LOG(WARNING) << "Can't find auth file at " << auth_file.value(); |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 | 142 |
| 143 dict->GetString(kOAuthRefreshToken, &auth_params->refresh_token); | 143 dict->GetString(kOAuthRefreshToken, &auth_params->refresh_token); |
| 144 dict->GetString(kOAuthClientId, &auth_params->client_id); | 144 dict->GetString(kOAuthClientId, &auth_params->client_id); |
| 145 dict->GetString(kOAuthClientSecret, &auth_params->client_secret); | 145 dict->GetString(kOAuthClientSecret, &auth_params->client_secret); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 UpdateAppData(); | 475 UpdateAppData(); |
| 476 delegate_->OnReadyToLaunch(); | 476 delegate_->OnReadyToLaunch(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 void StartupAppLauncher::UpdateAppData() { | 479 void StartupAppLauncher::UpdateAppData() { |
| 480 KioskAppManager::Get()->ClearAppData(app_id_); | 480 KioskAppManager::Get()->ClearAppData(app_id_); |
| 481 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); | 481 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace chromeos | 484 } // namespace chromeos |
| OLD | NEW |