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

Side by Side Diff: chrome/browser/browser_init.cc

Issue 10973: Test the feasibility of turning Chrome into a multi-process ActiveX control Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 12 years, 1 month 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/browser/browser.cc ('k') | chrome/browser/browser_type.h » ('j') | 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/browser/browser_init.h" 5 #include "chrome/browser/browser_init.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 // old configuration that we should ignore. This hack saves us from some 660 // old configuration that we should ignore. This hack saves us from some
661 // infinite loops where we keep forwarding mailto: to the system, resulting 661 // infinite loops where we keep forwarding mailto: to the system, resulting
662 // in the system asking us to open the mailto app. 662 // in the system asking us to open the mailto app.
663 if (url.SchemeIs("mailto")) 663 if (url.SchemeIs("mailto"))
664 url = GURL("about:blank"); 664 url = GURL("about:blank");
665 665
666 WebAppLauncher::Launch(profile, url); 666 WebAppLauncher::Launch(profile, url);
667 return true; 667 return true;
668 } 668 }
669 669
670 // Check if we're running as an embedded client
671 if (parsed_command_line.HasSwitch(switches::kEmbeddedProcess)) {
672 std::wstring settings = parsed_command_line.GetSwitchValue(switches::kEmbedd edSettings);
673
674 HWND hwnd = NULL;
675 gfx::Rect rect;
676 std::wstring url = L"http://www.google.com";
677
678 // Parse the embedded settings argument
679 wchar_t* tok = wcstok(const_cast<wchar_t*>(settings.c_str()), L",");
680 for(int i = 0; tok; i++)
681 {
682 if(i == 0)
683 hwnd = (HWND)_wtol(tok);
684 else if(i == 1)
685 rect.set_x(_wtoi(tok));
686 else if(i == 2)
687 rect.set_y(_wtoi(tok));
688 else if(i == 3)
689 rect.set_width(_wtoi(tok));
690 else if(i == 4)
691 rect.set_height(_wtoi(tok));
692 else if(i == 5)
693 url = tok;
694 else
695 break;
696
697 tok = wcstok(NULL, L",");
698 }
699
700 // Create the embedded browser window
701 Browser* browser = Browser::CreateForEmbedded(hwnd, rect, profile);
702 browser->ShowNativeUITab(GURL(url));
703 browser->window()->Show();
704
705 return true;
706 }
707
670 LaunchWithProfile lwp(cur_dir, parsed_command_line.command_line_string()); 708 LaunchWithProfile lwp(cur_dir, parsed_command_line.command_line_string());
671 bool launched = lwp.Launch(profile, process_startup); 709 bool launched = lwp.Launch(profile, process_startup);
672 if (!launched) { 710 if (!launched) {
673 LOG(ERROR) << "launch error"; 711 LOG(ERROR) << "launch error";
674 if (return_code != NULL) { 712 if (return_code != NULL) {
675 *return_code = ResultCodes::INVALID_CMDLINE_URL; 713 *return_code = ResultCodes::INVALID_CMDLINE_URL;
676 } 714 }
677 return false; 715 return false;
678 } 716 }
679 717
680 return true; 718 return true;
681 } 719 }
OLDNEW
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/browser_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698