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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.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 17 matching lines...) Expand all Loading... |
28 const char* manifest_file) { | 28 const char* manifest_file) { |
29 scoped_refptr<Extension> extension; | 29 scoped_refptr<Extension> extension; |
30 | 30 |
31 base::FilePath path; | 31 base::FilePath path; |
32 PathService::Get(chrome::DIR_TEST_DATA, &path); | 32 PathService::Get(chrome::DIR_TEST_DATA, &path); |
33 path = path.AppendASCII("extensions") | 33 path = path.AppendASCII("extensions") |
34 .AppendASCII(extension_dir_name) | 34 .AppendASCII(extension_dir_name) |
35 .AppendASCII(manifest_file); | 35 .AppendASCII(manifest_file); |
36 | 36 |
37 std::string error; | 37 std::string error; |
38 JSONFileValueSerializer serializer(path); | 38 JSONFileValueDeserializer deserializer(path); |
39 scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( | 39 scoped_ptr<base::DictionaryValue> value(static_cast<base::DictionaryValue*>( |
40 serializer.Deserialize(NULL, &error))); | 40 deserializer.Deserialize(NULL, &error))); |
41 if (!value.get()) { | 41 if (!value.get()) { |
42 LOG(ERROR) << error; | 42 LOG(ERROR) << error; |
43 return extension; | 43 return extension; |
44 } | 44 } |
45 | 45 |
46 extension = Extension::Create( | 46 extension = Extension::Create( |
47 path.DirName(), extensions::Manifest::INVALID_LOCATION, *value, | 47 path.DirName(), extensions::Manifest::INVALID_LOCATION, *value, |
48 Extension::NO_FLAGS, &error); | 48 Extension::NO_FLAGS, &error); |
49 if (!extension.get()) | 49 if (!extension.get()) |
50 LOG(ERROR) << error; | 50 LOG(ERROR) << error; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 BuildExtensionPostInstallPermissionsPrompt(Extension* extension) { | 85 BuildExtensionPostInstallPermissionsPrompt(Extension* extension) { |
86 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt = | 86 scoped_refptr<ExtensionInstallPrompt::Prompt> prompt = |
87 new ExtensionInstallPrompt::Prompt( | 87 new ExtensionInstallPrompt::Prompt( |
88 ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT); | 88 ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT); |
89 prompt->set_extension(extension); | 89 prompt->set_extension(extension); |
90 prompt->set_icon(LoadInstallPromptIcon()); | 90 prompt->set_icon(LoadInstallPromptIcon()); |
91 return prompt; | 91 return prompt; |
92 } | 92 } |
93 | 93 |
94 } // namespace chrome | 94 } // namespace chrome |
OLD | NEW |