| 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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/version.h" | 9 #include "base/version.h" |
| 10 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // Got the intalled version so the handling of the UPGRADE_ALREADY_UP_TO_DATE | 56 // Got the intalled version so the handling of the UPGRADE_ALREADY_UP_TO_DATE |
| 57 // result case can now be completeb on the UI thread. | 57 // result case can now be completeb on the UI thread. |
| 58 void GotInstalledVersion(const Version& version); | 58 void GotInstalledVersion(const Version& version); |
| 59 | 59 |
| 60 // Returns a window that can be used for elevation. | 60 // Returns a window that can be used for elevation. |
| 61 gfx::AcceleratedWidget GetElevationParent(); | 61 gfx::AcceleratedWidget GetElevationParent(); |
| 62 | 62 |
| 63 void BeginUpdateCheckOnFileThread(bool install_if_newer); | 63 void BeginUpdateCheckOnFileThread(bool install_if_newer); |
| 64 | 64 |
| 65 // Callback used to communicate update status to the client. |
| 66 StatusCallback callback_; |
| 67 |
| 65 // Used for callbacks. | 68 // Used for callbacks. |
| 66 base::WeakPtrFactory<VersionUpdaterWin> weak_factory_; | 69 base::WeakPtrFactory<VersionUpdaterWin> weak_factory_; |
| 67 | 70 |
| 68 // Callback used to communicate update status to the client. | |
| 69 StatusCallback callback_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterWin); | 71 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterWin); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // This class is used to read the version on the FILE thread and then call back | 74 // This class is used to read the version on the FILE thread and then call back |
| 75 // the version updater in the UI thread. Using a class helps better control | 75 // the version updater in the UI thread. Using a class helps better control |
| 76 // the lifespan of the Version independently of the lifespan of the version | 76 // the lifespan of the Version independently of the lifespan of the version |
| 77 // updater, which may die while asynchonicity is happening, thus the usage of | 77 // updater, which may die while asynchonicity is happening, thus the usage of |
| 78 // the WeakPtr, which can only be used from the thread that created it. | 78 // the WeakPtr, which can only be used from the thread that created it. |
| 79 class VersionReader | 79 class VersionReader |
| 80 : public base::RefCountedThreadSafe<VersionReader> { | 80 : public base::RefCountedThreadSafe<VersionReader> { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 BeginUpdateCheck(task_runner, install_if_newer, GetElevationParent(), | 261 BeginUpdateCheck(task_runner, install_if_newer, GetElevationParent(), |
| 262 base::Bind(&VersionUpdaterWin::OnUpdateCheckResults, | 262 base::Bind(&VersionUpdaterWin::OnUpdateCheckResults, |
| 263 weak_factory_.GetWeakPtr())); | 263 weak_factory_.GetWeakPtr())); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace | 266 } // namespace |
| 267 | 267 |
| 268 VersionUpdater* VersionUpdater::Create(content::BrowserContext* /* context */) { | 268 VersionUpdater* VersionUpdater::Create(content::BrowserContext* /* context */) { |
| 269 return new VersionUpdaterWin; | 269 return new VersionUpdaterWin; |
| 270 } | 270 } |
| OLD | NEW |