Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/ui/webui/help/version_updater_win.cc

Issue 2039273003: Cleanup: Remove VersionUpdater::RelaunchBrowser interface method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ui/webui/help/version_updater_win.h" 5 #include "chrome/browser/ui/webui/help/version_updater_win.h"
6 6
7 #include "base/memory/weak_ptr.h" 7 #include "base/memory/weak_ptr.h"
8 #include "base/task_runner_util.h" 8 #include "base/task_runner_util.h"
9 #include "base/win/win_util.h" 9 #include "base/win/win_util.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/first_run/upgrade_util.h" 12 #include "chrome/browser/first_run/upgrade_util.h"
13 #include "chrome/browser/lifetime/application_lifetime.h"
14 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
15 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
17 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
18 #include "ui/aura/window_tree_host.h" 17 #include "ui/aura/window_tree_host.h"
19 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
21 20
22 VersionUpdaterWin::VersionUpdaterWin(gfx::AcceleratedWidget owner_widget) 21 VersionUpdaterWin::VersionUpdaterWin(gfx::AcceleratedWidget owner_widget)
23 : owner_widget_(owner_widget), weak_factory_(this) { 22 : owner_widget_(owner_widget), weak_factory_(this) {
(...skipping 13 matching lines...) Expand all
37 // work as before - enabling UAC or installing the latest service pack 36 // work as before - enabling UAC or installing the latest service pack
38 // for Vista is another option. 37 // for Vista is another option.
39 if (!(base::win::GetVersion() == base::win::VERSION_VISTA && 38 if (!(base::win::GetVersion() == base::win::VERSION_VISTA &&
40 (base::win::OSInfo::GetInstance()->service_pack().major == 0) && 39 (base::win::OSInfo::GetInstance()->service_pack().major == 0) &&
41 !base::win::UserAccountControlIsEnabled())) { 40 !base::win::UserAccountControlIsEnabled())) {
42 callback_.Run(CHECKING, 0, base::string16()); 41 callback_.Run(CHECKING, 0, base::string16());
43 BeginUpdateCheckOnFileThread(false /* !install_update_if_possible */); 42 BeginUpdateCheckOnFileThread(false /* !install_update_if_possible */);
44 } 43 }
45 } 44 }
46 45
47 void VersionUpdaterWin::RelaunchBrowser() const {
48 chrome::AttemptRestart();
49 }
50
51 void VersionUpdaterWin::OnUpdateCheckComplete( 46 void VersionUpdaterWin::OnUpdateCheckComplete(
52 const base::string16& new_version) { 47 const base::string16& new_version) {
53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 48 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
54 Status status = CHECKING; 49 Status status = CHECKING;
55 if (new_version.empty()) { 50 if (new_version.empty()) {
56 // Google Update says that no new version is available. Check to see if a 51 // Google Update says that no new version is available. Check to see if a
57 // restart is needed for a previously-applied update to take effect. 52 // restart is needed for a previously-applied update to take effect.
58 if (base::PostTaskAndReplyWithResult( 53 if (base::PostTaskAndReplyWithResult(
59 content::BrowserThread::GetBlockingPool(), 54 content::BrowserThread::GetBlockingPool(),
60 FROM_HERE, 55 FROM_HERE,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // have been closed by the time the UAC prompt is needed. In this case, the 138 // have been closed by the time the UAC prompt is needed. In this case, the
144 // web contents may no longer be hosted in a window, leading either 139 // web contents may no longer be hosted in a window, leading either
145 // GetTopLevelNativeWindow or GetHost to return null. Passing nullptr to 140 // GetTopLevelNativeWindow or GetHost to return null. Passing nullptr to
146 // VersionUpdaterWin will then also cause the UAC prompt to appear in the task 141 // VersionUpdaterWin will then also cause the UAC prompt to appear in the task
147 // bar. 142 // bar.
148 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); 143 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow();
149 aura::WindowTreeHost* window_tree_host = window ? window->GetHost() : nullptr; 144 aura::WindowTreeHost* window_tree_host = window ? window->GetHost() : nullptr;
150 return new VersionUpdaterWin( 145 return new VersionUpdaterWin(
151 window_tree_host ? window_tree_host->GetAcceleratedWidget() : nullptr); 146 window_tree_host ? window_tree_host->GetAcceleratedWidget() : nullptr);
152 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/help/version_updater_win.h ('k') | chrome/browser/ui/webui/settings/about_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698