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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 (*id)[i] = val + 'a'; | 566 (*id)[i] = val + 'a'; |
567 } else { | 567 } else { |
568 (*id)[i] = 'a'; | 568 (*id)[i] = 'a'; |
569 } | 569 } |
570 } | 570 } |
571 } | 571 } |
572 | 572 |
573 std::string GenerateExtensionId(const std::string& input) { | 573 std::string GenerateExtensionId(const std::string& input) { |
574 uint8 hash[16]; | 574 uint8 hash[16]; |
575 crypto::SHA256HashString(input, hash, sizeof(hash)); | 575 crypto::SHA256HashString(input, hash, sizeof(hash)); |
576 std::string output = | 576 std::string output = base::ToLowerASCII(base::HexEncode(hash, sizeof(hash))); |
577 base::StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); | |
578 ConvertHexadecimalToIDAlphabet(&output); | 577 ConvertHexadecimalToIDAlphabet(&output); |
579 return output; | 578 return output; |
580 } | 579 } |
581 | 580 |
582 Status GetExtensionBackgroundPage(const base::DictionaryValue* manifest, | 581 Status GetExtensionBackgroundPage(const base::DictionaryValue* manifest, |
583 const std::string& id, | 582 const std::string& id, |
584 std::string* bg_page) { | 583 std::string* bg_page) { |
585 std::string bg_page_name; | 584 std::string bg_page_name; |
586 bool persistent = true; | 585 bool persistent = true; |
587 manifest->GetBoolean("background.persistent", &persistent); | 586 manifest->GetBoolean("background.persistent", &persistent); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 // Write empty "First Run" file, otherwise Chrome will wipe the default | 842 // Write empty "First Run" file, otherwise Chrome will wipe the default |
844 // profile that was written. | 843 // profile that was written. |
845 if (base::WriteFile( | 844 if (base::WriteFile( |
846 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 845 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
847 return Status(kUnknownError, "failed to write first run file"); | 846 return Status(kUnknownError, "failed to write first run file"); |
848 } | 847 } |
849 return Status(kOk); | 848 return Status(kOk); |
850 } | 849 } |
851 | 850 |
852 } // namespace internal | 851 } // namespace internal |
OLD | NEW |