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

Side by Side Diff: win8/test/test_registrar.cc

Issue 819223002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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
« no previous file with comments | « win8/test/metro_registration_helper.cc ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 // Win8 default browser registration utility. 5 // Win8 default browser registration utility.
6 // 6 //
7 // This tool can register and unregister a given exe as a potential default 7 // This tool can register and unregister a given exe as a potential default
8 // metro browser on Win8. It does not make the exe become THE default browser, 8 // metro browser on Win8. It does not make the exe become THE default browser,
9 // for a mechnism to do this please see open_with_dialog_controller.h. 9 // for a mechnism to do this please see open_with_dialog_controller.h.
10 // 10 //
(...skipping 15 matching lines...) Expand all
26 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
27 #include "win8/test/test_registrar_constants.h" 27 #include "win8/test/test_registrar_constants.h"
28 #include "win8/test/test_registrar_resource.h" 28 #include "win8/test/test_registrar_resource.h"
29 29
30 namespace { 30 namespace {
31 31
32 const wchar_t kDelegateExecuteCLSID[] = 32 const wchar_t kDelegateExecuteCLSID[] =
33 L"{FC0064A6-D1DE-4A83-92D2-5BB4EEBB70B5}"; 33 L"{FC0064A6-D1DE-4A83-92D2-5BB4EEBB70B5}";
34 34
35 void InitializeCommandLineDefaultValues() { 35 void InitializeCommandLineDefaultValues() {
36 CommandLine& command_line = *CommandLine::ForCurrentProcess(); 36 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
37 37
38 if (!command_line.HasSwitch(win8::test::kTestAppUserModelId)) 38 if (!command_line.HasSwitch(win8::test::kTestAppUserModelId))
39 command_line.AppendSwitchNative(win8::test::kTestAppUserModelId, 39 command_line.AppendSwitchNative(win8::test::kTestAppUserModelId,
40 win8::test::kDefaultTestAppUserModelId); 40 win8::test::kDefaultTestAppUserModelId);
41 41
42 if (!command_line.HasSwitch(win8::test::kTestExeName)) 42 if (!command_line.HasSwitch(win8::test::kTestExeName))
43 command_line.AppendSwitchNative(win8::test::kTestExeName, 43 command_line.AppendSwitchNative(win8::test::kTestExeName,
44 win8::test::kDefaultTestExeName); 44 win8::test::kDefaultTestExeName);
45 45
46 if (!command_line.HasSwitch(win8::test::kTestExePath)) { 46 if (!command_line.HasSwitch(win8::test::kTestExePath)) {
(...skipping 26 matching lines...) Expand all
73 } 73 }
74 74
75 virtual HRESULT AddCommonRGSReplacements(IRegistrarBase* registrar) throw() { 75 virtual HRESULT AddCommonRGSReplacements(IRegistrarBase* registrar) throw() {
76 AtlTrace(L"In %hs\n", __FUNCTION__); 76 AtlTrace(L"In %hs\n", __FUNCTION__);
77 HRESULT hr = ParentClass::AddCommonRGSReplacements(registrar); 77 HRESULT hr = ParentClass::AddCommonRGSReplacements(registrar);
78 if (FAILED(hr)) 78 if (FAILED(hr))
79 return hr; 79 return hr;
80 80
81 registrar->AddReplacement(L"DELEGATE_EXECUTE_CLSID", kDelegateExecuteCLSID); 81 registrar->AddReplacement(L"DELEGATE_EXECUTE_CLSID", kDelegateExecuteCLSID);
82 82
83 CommandLine& command_line = *CommandLine::ForCurrentProcess(); 83 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
84 84
85 registrar->AddReplacement(L"APP_USER_MODEL_ID", 85 registrar->AddReplacement(L"APP_USER_MODEL_ID",
86 command_line.GetSwitchValueNative( 86 command_line.GetSwitchValueNative(
87 win8::test::kTestAppUserModelId).c_str()); 87 win8::test::kTestAppUserModelId).c_str());
88 registrar->AddReplacement(L"EXE_NAME", 88 registrar->AddReplacement(L"EXE_NAME",
89 command_line.GetSwitchValueNative( 89 command_line.GetSwitchValueNative(
90 win8::test::kTestExeName).c_str()); 90 win8::test::kTestExeName).c_str());
91 registrar->AddReplacement(L"PROG_ID", 91 registrar->AddReplacement(L"PROG_ID",
92 command_line.GetSwitchValueNative( 92 command_line.GetSwitchValueNative(
93 win8::test::kTestProgId).c_str()); 93 win8::test::kTestProgId).c_str());
(...skipping 28 matching lines...) Expand all
122 &CLSID_TestDefaultBrowserRegistrar> { 122 &CLSID_TestDefaultBrowserRegistrar> {
123 public: 123 public:
124 DECLARE_REGISTRY_RESOURCEID(IDR_TESTDELEGATEEXECUTE); 124 DECLARE_REGISTRY_RESOURCEID(IDR_TESTDELEGATEEXECUTE);
125 125
126 BEGIN_COM_MAP(TestDefaultBrowserRegistrar) 126 BEGIN_COM_MAP(TestDefaultBrowserRegistrar)
127 END_COM_MAP() 127 END_COM_MAP()
128 }; 128 };
129 129
130 extern "C" int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int nShowCmd) { 130 extern "C" int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int nShowCmd) {
131 base::AtExitManager exit_manager; 131 base::AtExitManager exit_manager;
132 CommandLine::Init(0, NULL); 132 base::CommandLine::Init(0, NULL);
133 InitializeCommandLineDefaultValues(); 133 InitializeCommandLineDefaultValues();
134 134
135 HRESULT ret_code = _AtlModule.WinMain(nShowCmd); 135 HRESULT ret_code = _AtlModule.WinMain(nShowCmd);
136 136
137 return ret_code; 137 return ret_code;
138 } 138 }
139 139
140 OBJECT_ENTRY_AUTO(__uuidof(TestDefaultBrowserRegistrar), 140 OBJECT_ENTRY_AUTO(__uuidof(TestDefaultBrowserRegistrar),
141 TestDefaultBrowserRegistrar); 141 TestDefaultBrowserRegistrar);
OLDNEW
« no previous file with comments | « win8/test/metro_registration_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698