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/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" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 message = l10n_util::GetStringFUTF16( | 108 message = l10n_util::GetStringFUTF16( |
109 IDS_ABOUT_BOX_ERROR_DURING_UPDATE_CHECK, html_error_message); | 109 IDS_ABOUT_BOX_ERROR_DURING_UPDATE_CHECK, html_error_message); |
110 } | 110 } |
111 break; | 111 break; |
112 } | 112 } |
113 callback_.Run(status, 0, message); | 113 callback_.Run(status, 0, message); |
114 } | 114 } |
115 | 115 |
116 void VersionUpdaterWin::BeginUpdateCheckOnFileThread( | 116 void VersionUpdaterWin::BeginUpdateCheckOnFileThread( |
117 bool install_update_if_possible) { | 117 bool install_update_if_possible) { |
118 BeginUpdateCheck(content::BrowserThread::GetMessageLoopProxyForThread( | 118 BeginUpdateCheck(content::BrowserThread::GetTaskRunnerForThread( |
119 content::BrowserThread::FILE), | 119 content::BrowserThread::FILE), |
120 g_browser_process->GetApplicationLocale(), | 120 g_browser_process->GetApplicationLocale(), |
121 install_update_if_possible, owner_widget_, | 121 install_update_if_possible, owner_widget_, |
122 weak_factory_.GetWeakPtr()); | 122 weak_factory_.GetWeakPtr()); |
123 } | 123 } |
124 | 124 |
125 void VersionUpdaterWin::OnPendingRestartCheck(bool is_update_pending_restart) { | 125 void VersionUpdaterWin::OnPendingRestartCheck(bool is_update_pending_restart) { |
126 callback_.Run(is_update_pending_restart ? NEARLY_UPDATED : UPDATED, 0, | 126 callback_.Run(is_update_pending_restart ? NEARLY_UPDATED : UPDATED, 0, |
127 base::string16()); | 127 base::string16()); |
128 } | 128 } |
129 | 129 |
130 VersionUpdater* VersionUpdater::Create(content::WebContents* web_contents) { | 130 VersionUpdater* VersionUpdater::Create(content::WebContents* web_contents) { |
131 // Retrieve the HWND for the browser window that is hosting the update check. | 131 // Retrieve the HWND for the browser window that is hosting the update check. |
132 // This will be used as the parent for a UAC prompt, if needed. It's possible | 132 // This will be used as the parent for a UAC prompt, if needed. It's possible |
133 // this this window will no longer have focus by the time UAC is needed. In | 133 // this this window will no longer have focus by the time UAC is needed. In |
134 // that case, the UAC prompt will appear in the taskbar and will require a | 134 // that case, the UAC prompt will appear in the taskbar and will require a |
135 // user click. This is the least surprising thing we can do for the user, and | 135 // user click. This is the least surprising thing we can do for the user, and |
136 // is the intended behavior for Windows applications. | 136 // is the intended behavior for Windows applications. |
137 // It's also possible that the browser window hosting the update check will | 137 // It's also possible that the browser window hosting the update check will |
138 // 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 |
139 // 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 |
140 // GetTopLevelNativeWindow or GetHost to return null. Passing nullptr to | 140 // GetTopLevelNativeWindow or GetHost to return null. Passing nullptr to |
141 // 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 |
142 // bar. | 142 // bar. |
143 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); | 143 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); |
144 aura::WindowTreeHost* window_tree_host = window ? window->GetHost() : nullptr; | 144 aura::WindowTreeHost* window_tree_host = window ? window->GetHost() : nullptr; |
145 return new VersionUpdaterWin( | 145 return new VersionUpdaterWin( |
146 window_tree_host ? window_tree_host->GetAcceleratedWidget() : nullptr); | 146 window_tree_host ? window_tree_host->GetAcceleratedWidget() : nullptr); |
147 } | 147 } |
OLD | NEW |