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

Side by Side Diff: tools/set_default_handler/set_default_handler_main.cc

Issue 16519003: Define a LoggingSettings struct to use for InitLogging() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error Created 7 years, 6 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) 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 // Makes a given program ("Google Chrome" by default) the default handler for 5 // Makes a given program ("Google Chrome" by default) the default handler for
6 // some URL protocol ("http" by default) on Windows 8. These defaults can be 6 // some URL protocol ("http" by default) on Windows 8. These defaults can be
7 // overridden via the --program and --protocol command line switches. 7 // overridden via the --program and --protocol command line switches.
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 13 matching lines...) Expand all
24 const wchar_t kDefaultProtocol[] = L"http"; 24 const wchar_t kDefaultProtocol[] = L"http";
25 25
26 } // namespace 26 } // namespace
27 27
28 extern "C" 28 extern "C"
29 int wmain(int argc, wchar_t* argv[]) { 29 int wmain(int argc, wchar_t* argv[]) {
30 // Initialize the commandline singleton from the environment. 30 // Initialize the commandline singleton from the environment.
31 CommandLine::Init(0, NULL); 31 CommandLine::Init(0, NULL);
32 // The exit manager is in charge of calling the dtors of singletons. 32 // The exit manager is in charge of calling the dtors of singletons.
33 base::AtExitManager exit_manager; 33 base::AtExitManager exit_manager;
34 logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, 34 logging::LoggingSettings settings;
35 logging::DONT_LOCK_LOG_FILE, 35 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
36 logging::APPEND_TO_OLD_LOG_FILE, 36 settings.dcheck_state =
37 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); 37 logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
38 logging::InitLogging(settings);
38 logging::SetMinLogLevel(logging::LOG_VERBOSE); 39 logging::SetMinLogLevel(logging::LOG_VERBOSE);
39 40
40 ui::win::CreateATLModuleIfNeeded(); 41 ui::win::CreateATLModuleIfNeeded();
41 42
42 CommandLine* command_line = CommandLine::ForCurrentProcess(); 43 CommandLine* command_line = CommandLine::ForCurrentProcess();
43 string16 protocol(command_line->GetSwitchValueNative(kSwitchProtocol)); 44 string16 protocol(command_line->GetSwitchValueNative(kSwitchProtocol));
44 if (protocol.empty()) 45 if (protocol.empty())
45 protocol = kDefaultProtocol; 46 protocol = kDefaultProtocol;
46 47
47 string16 program(command_line->GetSwitchValueNative(kSwitchProgram)); 48 string16 program(command_line->GetSwitchValueNative(kSwitchProgram));
48 if (program.empty()) 49 if (program.empty())
49 program = kDefaultProgram; 50 program = kDefaultProgram;
50 51
51 std::vector<string16> choices; 52 std::vector<string16> choices;
52 HRESULT result = S_OK; 53 HRESULT result = S_OK;
53 win8::OpenWithDialogController controller; 54 win8::OpenWithDialogController controller;
54 result = controller.RunSynchronously(NULL, protocol, program, &choices); 55 result = controller.RunSynchronously(NULL, protocol, program, &choices);
55 56
56 if (SUCCEEDED(result)) { 57 if (SUCCEEDED(result)) {
57 printf("success\n"); 58 printf("success\n");
58 } else if (!choices.empty()) { 59 } else if (!choices.empty()) {
59 printf("failed to set program. possible choices: %ls\n", 60 printf("failed to set program. possible choices: %ls\n",
60 JoinString(choices, L", ").c_str()); 61 JoinString(choices, L", ").c_str());
61 } else { 62 } else {
62 printf("failed with HRESULT: 0x08X\n", result); 63 printf("failed with HRESULT: 0x08X\n", result);
63 } 64 }
64 65
65 return FAILED(result); 66 return FAILED(result);
66 } 67 }
OLDNEW
« no previous file with comments | « tools/android/forwarder2/daemon.cc ('k') | ui/views/examples/content_client/examples_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698