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