| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.
h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.
h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 gfx::Image LoadInstallPromptIcon() { | 53 gfx::Image LoadInstallPromptIcon() { |
| 54 base::FilePath path; | 54 base::FilePath path; |
| 55 PathService::Get(chrome::DIR_TEST_DATA, &path); | 55 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 56 path = path.AppendASCII("extensions") | 56 path = path.AppendASCII("extensions") |
| 57 .AppendASCII("install_prompt") | 57 .AppendASCII("install_prompt") |
| 58 .AppendASCII("icon.png"); | 58 .AppendASCII("icon.png"); |
| 59 | 59 |
| 60 std::string file_contents; | 60 std::string file_contents; |
| 61 file_util::ReadFileToString(path, &file_contents); | 61 base::ReadFileToString(path, &file_contents); |
| 62 | 62 |
| 63 return gfx::Image::CreateFrom1xPNGBytes( | 63 return gfx::Image::CreateFrom1xPNGBytes( |
| 64 reinterpret_cast<const unsigned char*>(file_contents.c_str()), | 64 reinterpret_cast<const unsigned char*>(file_contents.c_str()), |
| 65 file_contents.length()); | 65 file_contents.length()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ExtensionInstallPrompt::Prompt BuildExtensionInstallPrompt( | 68 ExtensionInstallPrompt::Prompt BuildExtensionInstallPrompt( |
| 69 Extension* extension) { | 69 Extension* extension) { |
| 70 ExtensionInstallPrompt::Prompt prompt(ExtensionInstallPrompt::INSTALL_PROMPT); | 70 ExtensionInstallPrompt::Prompt prompt(ExtensionInstallPrompt::INSTALL_PROMPT); |
| 71 prompt.set_extension(extension); | 71 prompt.set_extension(extension); |
| 72 prompt.set_icon(LoadInstallPromptIcon()); | 72 prompt.set_icon(LoadInstallPromptIcon()); |
| 73 return prompt; | 73 return prompt; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ExtensionInstallPrompt::Prompt BuildExtensionPostInstallPermissionsPrompt( | 76 ExtensionInstallPrompt::Prompt BuildExtensionPostInstallPermissionsPrompt( |
| 77 Extension* extension) { | 77 Extension* extension) { |
| 78 ExtensionInstallPrompt::Prompt prompt( | 78 ExtensionInstallPrompt::Prompt prompt( |
| 79 ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT); | 79 ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT); |
| 80 prompt.set_extension(extension); | 80 prompt.set_extension(extension); |
| 81 prompt.set_icon(LoadInstallPromptIcon()); | 81 prompt.set_icon(LoadInstallPromptIcon()); |
| 82 return prompt; | 82 return prompt; |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace chrome | 85 } // namespace chrome |
| OLD | NEW |