OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/external_pref_extension_provider.h" | 5 #include "chrome/browser/extensions/external_pref_extension_provider.h" |
6 | 6 |
7 #include "app/app_paths.h" | 7 #include "app/app_paths.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 FilePath path(external_crx); | 68 FilePath path(external_crx); |
69 if (!path.IsAbsolute()) { | 69 if (!path.IsAbsolute()) { |
70 // Try path as relative path from external extension dir. | 70 // Try path as relative path from external extension dir. |
71 FilePath base_path; | 71 FilePath base_path; |
72 PathService::Get(app::DIR_EXTERNAL_EXTENSIONS, &base_path); | 72 PathService::Get(app::DIR_EXTERNAL_EXTENSIONS, &base_path); |
73 path = base_path.Append(external_crx); | 73 path = base_path.Append(external_crx); |
74 } | 74 } |
75 | 75 |
76 scoped_ptr<Version> version; | 76 scoped_ptr<Version> version; |
77 version.reset(Version::GetVersionFromString(external_version)); | 77 version.reset(Version::GetVersionFromString(external_version)); |
78 visitor->OnExternalExtensionFound( | 78 visitor->OnExternalExtensionFound(WideToASCII(extension_id), version.get(), |
79 WideToASCII(extension_id), version.get(), path); | 79 path, Extension::EXTERNAL_PREF); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 Version* ExternalPrefExtensionProvider::RegisteredVersion( | 83 Version* ExternalPrefExtensionProvider::RegisteredVersion( |
84 const std::string& id, Extension::Location* location) const { | 84 const std::string& id, Extension::Location* location) const { |
85 DictionaryValue* extension = NULL; | 85 DictionaryValue* extension = NULL; |
86 if (!prefs_->GetDictionary(ASCIIToWide(id), &extension)) | 86 if (!prefs_->GetDictionary(ASCIIToWide(id), &extension)) |
87 return NULL; | 87 return NULL; |
88 | 88 |
89 std::string external_version; | 89 std::string external_version; |
(...skipping 18 matching lines...) Expand all Loading... |
108 if (extensions) { | 108 if (extensions) { |
109 if (!extensions->IsType(Value::TYPE_DICTIONARY)) { | 109 if (!extensions->IsType(Value::TYPE_DICTIONARY)) { |
110 NOTREACHED() << L"Invalid json data"; | 110 NOTREACHED() << L"Invalid json data"; |
111 } else { | 111 } else { |
112 dictionary.reset(static_cast<DictionaryValue*>(extensions)); | 112 dictionary.reset(static_cast<DictionaryValue*>(extensions)); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 prefs_.reset(dictionary.release()); | 116 prefs_.reset(dictionary.release()); |
117 } | 117 } |
OLD | NEW |