| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/test/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/base64.h" | 10 #include "base/base64.h" | 
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 768   bg_pages->swap(bg_pages_tmp); | 768   bg_pages->swap(bg_pages_tmp); | 
| 769   return Status(kOk); | 769   return Status(kOk); | 
| 770 } | 770 } | 
| 771 | 771 | 
| 772 Status WritePrefsFile( | 772 Status WritePrefsFile( | 
| 773     const std::string& template_string, | 773     const std::string& template_string, | 
| 774     const base::DictionaryValue* custom_prefs, | 774     const base::DictionaryValue* custom_prefs, | 
| 775     const base::FilePath& path) { | 775     const base::FilePath& path) { | 
| 776   int code; | 776   int code; | 
| 777   std::string error_msg; | 777   std::string error_msg; | 
| 778   scoped_ptr<base::Value> template_value( | 778   scoped_ptr<base::Value> template_value = base::JSONReader::ReadAndReturnError( | 
| 779       base::JSONReader::DeprecatedReadAndReturnError(template_string, 0, &code, | 779       template_string, 0, &code, &error_msg); | 
| 780                                                      &error_msg)); |  | 
| 781   base::DictionaryValue* prefs; | 780   base::DictionaryValue* prefs; | 
| 782   if (!template_value || !template_value->GetAsDictionary(&prefs)) { | 781   if (!template_value || !template_value->GetAsDictionary(&prefs)) { | 
| 783     return Status(kUnknownError, | 782     return Status(kUnknownError, | 
| 784                   "cannot parse internal JSON template: " + error_msg); | 783                   "cannot parse internal JSON template: " + error_msg); | 
| 785   } | 784   } | 
| 786 | 785 | 
| 787   if (custom_prefs) { | 786   if (custom_prefs) { | 
| 788     for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); | 787     for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); | 
| 789          it.Advance()) { | 788          it.Advance()) { | 
| 790       prefs->Set(it.key(), it.value().DeepCopy()); | 789       prefs->Set(it.key(), it.value().DeepCopy()); | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 845   // Write empty "First Run" file, otherwise Chrome will wipe the default | 844   // Write empty "First Run" file, otherwise Chrome will wipe the default | 
| 846   // profile that was written. | 845   // profile that was written. | 
| 847   if (base::WriteFile( | 846   if (base::WriteFile( | 
| 848           user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 847           user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 
| 849     return Status(kUnknownError, "failed to write first run file"); | 848     return Status(kUnknownError, "failed to write first run file"); | 
| 850   } | 849   } | 
| 851   return Status(kOk); | 850   return Status(kOk); | 
| 852 } | 851 } | 
| 853 | 852 | 
| 854 }  // namespace internal | 853 }  // namespace internal | 
| OLD | NEW | 
|---|