| 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 #include "chrome/browser/extensions/external_registry_loader_win.h" | 5 #include "chrome/browser/extensions/external_registry_loader_win.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_handle.h" | 10 #include "base/files/scoped_file.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "base/version.h" | 16 #include "base/version.h" |
| 17 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
| 18 #include "chrome/browser/extensions/external_provider_impl.h" | 18 #include "chrome/browser/extensions/external_provider_impl.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 // Registry value of the key that defines the path to the .crx file. | 32 // Registry value of the key that defines the path to the .crx file. |
| 33 const wchar_t kRegistryExtensionPath[] = L"path"; | 33 const wchar_t kRegistryExtensionPath[] = L"path"; |
| 34 | 34 |
| 35 // Registry value of that key that defines the current version of the .crx file. | 35 // Registry value of that key that defines the current version of the .crx file. |
| 36 const wchar_t kRegistryExtensionVersion[] = L"version"; | 36 const wchar_t kRegistryExtensionVersion[] = L"version"; |
| 37 | 37 |
| 38 // Registry value of the key that defines an external update URL. | 38 // Registry value of the key that defines an external update URL. |
| 39 const wchar_t kRegistryExtensionUpdateUrl[] = L"update_url"; | 39 const wchar_t kRegistryExtensionUpdateUrl[] = L"update_url"; |
| 40 | 40 |
| 41 bool CanOpenFileForReading(const base::FilePath& path) { | 41 bool CanOpenFileForReading(const base::FilePath& path) { |
| 42 ScopedStdioHandle file_handle(base::OpenFile(path, "rb")); | 42 base::ScopedFILE file_handle(base::OpenFile(path, "rb")); |
| 43 return file_handle.get() != NULL; | 43 return file_handle.get() != NULL; |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 namespace extensions { | 48 namespace extensions { |
| 49 | 49 |
| 50 void ExternalRegistryLoader::StartLoading() { | 50 void ExternalRegistryLoader::StartLoading() { |
| 51 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 52 BrowserThread::PostTask( | 52 BrowserThread::PostTask( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 prefs_.reset(prefs.release()); | 174 prefs_.reset(prefs.release()); |
| 175 HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", | 175 HISTOGRAM_TIMES("Extensions.ExternalRegistryLoaderWin", |
| 176 base::TimeTicks::Now() - start_time); | 176 base::TimeTicks::Now() - start_time); |
| 177 BrowserThread::PostTask( | 177 BrowserThread::PostTask( |
| 178 BrowserThread::UI, FROM_HERE, | 178 BrowserThread::UI, FROM_HERE, |
| 179 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); | 179 base::Bind(&ExternalRegistryLoader::LoadFinished, this)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |