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 // NOTE: This code is a legacy utility API for partners to check whether | 5 // NOTE: This code is a legacy utility API for partners to check whether |
6 // Chrome can be installed and launched. Recent updates are being made | 6 // Chrome can be installed and launched. Recent updates are being made |
7 // to add new functionality. These updates use code from Chromium, the old | 7 // to add new functionality. These updates use code from Chromium, the old |
8 // coded against the win32 api directly. If you have an itch to shave a | 8 // coded against the win32 api directly. If you have an itch to shave a |
9 // yak, feel free to re-write the old code too. | 9 // yak, feel free to re-write the old code too. |
10 | 10 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 bool success; | 359 bool success; |
360 std::set<HWND> shunted_hwnds; | 360 std::set<HWND> shunted_hwnds; |
361 }; | 361 }; |
362 | 362 |
363 BOOL CALLBACK ChromeWindowEnumProc(HWND hwnd, LPARAM lparam) { | 363 BOOL CALLBACK ChromeWindowEnumProc(HWND hwnd, LPARAM lparam) { |
364 wchar_t window_class[MAX_PATH] = {}; | 364 wchar_t window_class[MAX_PATH] = {}; |
365 SetWindowPosParams* params = reinterpret_cast<SetWindowPosParams*>(lparam); | 365 SetWindowPosParams* params = reinterpret_cast<SetWindowPosParams*>(lparam); |
366 | 366 |
367 if (!params->shunted_hwnds.count(hwnd) && | 367 if (!params->shunted_hwnds.count(hwnd) && |
368 ::GetClassName(hwnd, window_class, arraysize(window_class)) && | 368 ::GetClassName(hwnd, window_class, arraysize(window_class)) && |
369 StartsWith(window_class, kChromeWindowClassPrefix, false) && | 369 base::StartsWith(window_class, kChromeWindowClassPrefix, false) && |
370 ::SetWindowPos(hwnd, params->window_insert_after, params->x, | 370 ::SetWindowPos(hwnd, params->window_insert_after, params->x, params->y, |
371 params->y, params->width, params->height, params->flags)) { | 371 params->width, params->height, params->flags)) { |
372 params->shunted_hwnds.insert(hwnd); | 372 params->shunted_hwnds.insert(hwnd); |
373 params->success = true; | 373 params->success = true; |
374 } | 374 } |
375 | 375 |
376 // Return TRUE to ensure we hit all possible top-level Chrome windows as per | 376 // Return TRUE to ensure we hit all possible top-level Chrome windows as per |
377 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633498.aspx | 377 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms633498.aspx |
378 return TRUE; | 378 return TRUE; |
379 } | 379 } |
380 | 380 |
381 // Returns true and populates |chrome_exe_path| with the path to chrome.exe if | 381 // Returns true and populates |chrome_exe_path| with the path to chrome.exe if |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 key.WriteValue(kRelaunchAllowedAfterValue, | 789 key.WriteValue(kRelaunchAllowedAfterValue, |
790 FormatDateOffsetByMonths(6)) != ERROR_SUCCESS || | 790 FormatDateOffsetByMonths(6)) != ERROR_SUCCESS || |
791 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) { | 791 !SetRelaunchExperimentLabels(relaunch_brandcode, shell_mode)) { |
792 if (error_code) | 792 if (error_code) |
793 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED; | 793 *error_code = RELAUNCH_ERROR_RELAUNCH_FAILED; |
794 return FALSE; | 794 return FALSE; |
795 } | 795 } |
796 | 796 |
797 return TRUE; | 797 return TRUE; |
798 } | 798 } |
OLD | NEW |