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

Side by Side Diff: chrome_frame/chrome_tab.cc

Issue 7065024: Add a self-destruct mechanism to user-level Chrome Frame when it detects that system-level Chrome... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // chrome_tab.cc : Implementation of DLL Exports. 5 // chrome_tab.cc : Implementation of DLL Exports.
6 6
7 // Include without path to make GYP build see it. 7 // Include without path to make GYP build see it.
8 #include "chrome_tab.h" // NOLINT 8 #include "chrome_tab.h" // NOLINT
9 9
10 #include <atlsecurity.h> 10 #include <atlsecurity.h>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 const wchar_t kProtocolHandlers[] = 64 const wchar_t kProtocolHandlers[] =
65 L"Software\\Classes\\Protocols\\Handler"; 65 L"Software\\Classes\\Protocols\\Handler";
66 66
67 const wchar_t kRunOnce[] = 67 const wchar_t kRunOnce[] =
68 L"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce"; 68 L"Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
69 69
70 const wchar_t kRunKeyName[] = L"ChromeFrameHelper"; 70 const wchar_t kRunKeyName[] = L"ChromeFrameHelper";
71 71
72 const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe"; 72 const wchar_t kChromeFrameHelperExe[] = L"chrome_frame_helper.exe";
73 const wchar_t kChromeFrameHelperFirstRunArg[] = L"--first-run";
73 74
74 // Window class and window names. 75 // Window class and window names.
75 // TODO(robertshield): These and other constants need to be refactored into 76 // TODO(robertshield): These and other constants need to be refactored into
76 // a common chrome_frame_constants.h|cc and built into a separate lib 77 // a common chrome_frame_constants.h|cc and built into a separate lib
77 // (either chrome_frame_utils or make another one). 78 // (either chrome_frame_utils or make another one).
78 const wchar_t kChromeFrameHelperWindowClassName[] = 79 const wchar_t kChromeFrameHelperWindowClassName[] =
79 L"ChromeFrameHelperWindowClass"; 80 L"ChromeFrameHelperWindowClass";
80 const wchar_t kChromeFrameHelperWindowName[] = 81 const wchar_t kChromeFrameHelperWindowName[] =
81 L"ChromeFrameHelperWindowName"; 82 L"ChromeFrameHelperWindowName";
82 83
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 369 }
369 } else { 370 } else {
370 NOTREACHED(); 371 NOTREACHED();
371 } 372 }
372 373
373 // Find window handle of existing instance. 374 // Find window handle of existing instance.
374 HWND old_window = FindWindow(kChromeFrameHelperWindowClassName, 375 HWND old_window = FindWindow(kChromeFrameHelperWindowClassName,
375 kChromeFrameHelperWindowName); 376 kChromeFrameHelperWindowName);
376 377
377 if (file_util::PathExists(helper_path)) { 378 if (file_util::PathExists(helper_path)) {
379 std::wstring helper_path_cmd(helper_path.value());
grt (UTC plus 2) 2011/05/25 16:10:07 I think it's best to quote the path. Unless, of c
robertshield 2011/05/26 15:14:28 Done.
380 helper_path_cmd += L" ";
381 helper_path_cmd += kChromeFrameHelperFirstRunArg;
grt (UTC plus 2) 2011/05/25 16:10:07 Why not chrome::switches::kFirstRun?
robertshield 2011/05/26 15:14:28 they do different things, sorry I hadn't uploaded
382
378 // Add new run-at-startup entry. 383 // Add new run-at-startup entry.
379 base::win::AddCommandToAutoRun(HKEY_CURRENT_USER, kRunKeyName, 384 base::win::AddCommandToAutoRun(HKEY_CURRENT_USER, kRunKeyName,
380 helper_path.value()); 385 helper_path_cmd);
381 386
382 // Start new instance. 387 // Start new instance.
383 bool launched = base::LaunchApp(helper_path.value(), false, true, NULL); 388 bool launched = base::LaunchApp(helper_path.value(), false, true, NULL);
384 if (!launched) { 389 if (!launched) {
385 NOTREACHED(); 390 NOTREACHED();
386 LOG(ERROR) << "Could not launch helper process."; 391 LOG(ERROR) << "Could not launch helper process.";
387 } 392 }
388 393
389 // Kill old instance using window handle. 394 // Kill old instance using window handle.
390 if (IsWindow(old_window)) { 395 if (IsWindow(old_window)) {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 sd.GetDacl(&new_dacl); 845 sd.GetDacl(&new_dacl);
841 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ); 846 new_dacl.AddAllowedAce(token_.GetUser(), GENERIC_WRITE | GENERIC_READ);
842 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) { 847 if (AtlSetDacl(object_name.c_str(), SE_REGISTRY_KEY, new_dacl)) {
843 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE); 848 result = SetOrDeleteMimeHandlerKey(enable, HKEY_LOCAL_MACHINE);
844 } 849 }
845 } 850 }
846 851
847 backup.RestoreSecurity(object_name.c_str()); 852 backup.RestoreSecurity(object_name.c_str());
848 return result; 853 return result;
849 } 854 }
OLDNEW
« chrome_frame/chrome_frame_launcher.gyp ('K') | « chrome_frame/chrome_frame_launcher.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698