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

Side by Side Diff: chrome/installer/gcapi/gcapi.cc

Issue 101008: Adds a new API for launching Chrome at a given size and location. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/installer/gcapi/gcapi.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/installer/gcapi/gcapi.h" 5 #include "chrome/installer/gcapi/gcapi.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <windows.h> 9 #include <windows.h>
10 #include <sddl.h> 10 #include <sddl.h>
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 if (!FAILED(ipl->LaunchCmdLine(launch_cmd))) 401 if (!FAILED(ipl->LaunchCmdLine(launch_cmd)))
402 ret = true; 402 ret = true;
403 ipl.Release(); 403 ipl.Release();
404 } 404 }
405 405
406 if (impersonation_success) 406 if (impersonation_success)
407 ::RevertToSelf(); 407 ::RevertToSelf();
408 ::CoUninitialize(); 408 ::CoUninitialize();
409 return ret; 409 return ret;
410 } 410 }
411
412 #pragma comment(linker, "/EXPORT:LaunchGoogleChromeWithDimensions=_LaunchGoogleC hromeWithDimensions@16,PRIVATE")
413 DLLEXPORT BOOL __stdcall LaunchGoogleChromeWithDimensions(int x,
414 int y,
415 int width,
416 int height) {
417 if (!LaunchGoogleChrome())
418 return false;
419
420 HWND handle = NULL;
421 int seconds_elapsed = 0;
422
423 // Chrome may have been launched, but the window may not have appeared
424 // yet. Wait for it to appear for 10 seconds, but exit if it takes longer
425 // than that.
426 while (!handle && seconds_elapsed < 10) {
427 handle = FindWindowEx(NULL, handle, L"Chrome_WidgetWin_0", NULL);
428 if (!handle) {
429 Sleep(1000);
430 seconds_elapsed++;
431 }
432 }
433
434 if(!handle)
435 return false;
436
437 // At this point, there are several top-level Chrome windows
438 // but we only want the window that has child windows.
439
440 // This loop iterates through all of the top-level Windows named
441 // Chrome_WidgetWin_0, and looks for the first one with any children.
442 while (handle && !FindWindowEx(handle, NULL, L"Chrome_WidgetWin_0", NULL)) {
443 // Get the next top-level Chrome window.
444 handle = FindWindowEx(NULL, handle, L"Chrome_WidgetWin_0", NULL);
445 }
446
447 return (handle &&
448 SetWindowPos(handle, 0, x, y, width, height, SWP_NOZORDER));
449 }
OLDNEW
« no previous file with comments | « chrome/installer/gcapi/gcapi.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698