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

Side by Side Diff: chrome/browser/chromeos/app_mode/startup_app_launcher.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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
OLDNEW
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
118 base::Bind(&StartupAppLauncher::LoadOAuthFileOnBlockingPool, 118 base::Bind(&StartupAppLauncher::LoadOAuthFileOnBlockingPool,
119 auth_params), 119 auth_params),
120 base::Bind(&StartupAppLauncher::OnOAuthFileLoaded, 120 base::Bind(&StartupAppLauncher::OnOAuthFileLoaded,
121 AsWeakPtr(), 121 AsWeakPtr(),
122 base::Owned(auth_params))); 122 base::Owned(auth_params)));
123 } 123 }
124 124
125 // static. 125 // static.
126 void StartupAppLauncher::LoadOAuthFileOnBlockingPool( 126 void StartupAppLauncher::LoadOAuthFileOnBlockingPool(
127 KioskOAuthParams* auth_params) { 127 KioskOAuthParams* auth_params) {
128 int error_code = JSONFileValueSerializer::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<JSONFileValueSerializer> serializer( 133 scoped_ptr<JSONFileValueDeserializer> deserializer(
134 new JSONFileValueSerializer(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 serializer->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 != JSONFileValueSerializer::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);
147 } 147 }
148 148
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 UpdateAppData(); 397 UpdateAppData();
398 delegate_->OnReadyToLaunch(); 398 delegate_->OnReadyToLaunch();
399 } 399 }
400 400
401 void StartupAppLauncher::UpdateAppData() { 401 void StartupAppLauncher::UpdateAppData() {
402 KioskAppManager::Get()->ClearAppData(app_id_); 402 KioskAppManager::Get()->ClearAppData(app_id_);
403 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL); 403 KioskAppManager::Get()->UpdateAppDataFromProfile(app_id_, profile_, NULL);
404 } 404 }
405 405
406 } // namespace chromeos 406 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/kiosk_external_updater.cc ('k') | chrome/browser/chromeos/drive/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698