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

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

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698