OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(satorux): | 5 // TODO(satorux): |
6 // - Implement a scroll bar or an indicator showing where you are in the | 6 // - Implement a scroll bar or an indicator showing where you are in the |
7 // candidate window. | 7 // candidate window. |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "app/app_paths.h" | 13 #include "app/app_paths.h" |
14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/file_path.h" | 17 #include "base/file_path.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/process_util.h" | 21 #include "base/process_util.h" |
22 #include "base/scoped_ptr.h" | 22 #include "base/scoped_ptr.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "chrome/browser/chromeos/cros/cros_library_loader.h" | 24 #include "chrome/browser/chromeos/cros/cros_library_loader.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" |
26 #include "gfx/canvas.h" | 27 #include "gfx/canvas.h" |
27 #include "gfx/font.h" | 28 #include "gfx/font.h" |
28 #include "third_party/cros/chromeos_cros_api.h" | 29 #include "third_party/cros/chromeos_cros_api.h" |
29 #include "third_party/cros/chromeos_input_method_ui.h" | 30 #include "third_party/cros/chromeos_input_method_ui.h" |
30 #include "views/controls/label.h" | 31 #include "views/controls/label.h" |
31 #include "views/controls/textfield/textfield.h" | 32 #include "views/controls/textfield/textfield.h" |
32 #include "views/event.h" | 33 #include "views/event.h" |
33 #include "views/fill_layout.h" | 34 #include "views/fill_layout.h" |
34 #include "views/focus/accelerator_handler.h" | 35 #include "views/focus/accelerator_handler.h" |
35 #include "views/grid_layout.h" | 36 #include "views/grid_layout.h" |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 | 1012 |
1012 // Initialize Chrome stuff. | 1013 // Initialize Chrome stuff. |
1013 base::AtExitManager exit_manager; | 1014 base::AtExitManager exit_manager; |
1014 base::EnableTerminationOnHeapCorruption(); | 1015 base::EnableTerminationOnHeapCorruption(); |
1015 app::RegisterPathProvider(); | 1016 app::RegisterPathProvider(); |
1016 CommandLine::Init(argc, argv); | 1017 CommandLine::Init(argc, argv); |
1017 ResourceBundle::InitSharedInstance(L"en-US"); | 1018 ResourceBundle::InitSharedInstance(L"en-US"); |
1018 | 1019 |
1019 // Write logs to a file for debugging, if --logtofile=FILE_NAME is given. | 1020 // Write logs to a file for debugging, if --logtofile=FILE_NAME is given. |
1020 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1021 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1021 std::string log_file_name = command_line.GetSwitchValueASCII("logtofile"); | 1022 std::string log_file_name = |
| 1023 command_line.GetSwitchValueASCII(switches::kChromeosLogToFile); |
1022 if (!log_file_name.empty()) { | 1024 if (!log_file_name.empty()) { |
1023 logging::SetMinLogLevel(logging::LOG_INFO); | 1025 logging::SetMinLogLevel(logging::LOG_INFO); |
1024 logging::InitLogging(log_file_name.c_str(), | 1026 logging::InitLogging(log_file_name.c_str(), |
1025 logging::LOG_ONLY_TO_FILE, | 1027 logging::LOG_ONLY_TO_FILE, |
1026 logging::DONT_LOCK_LOG_FILE, | 1028 logging::DONT_LOCK_LOG_FILE, |
1027 logging::DELETE_OLD_LOG_FILE); | 1029 logging::DELETE_OLD_LOG_FILE); |
1028 // Redirect stderr to log_file_name. This is neeed to capture the | 1030 // Redirect stderr to log_file_name. This is neeed to capture the |
1029 // logging from libcros.so. | 1031 // logging from libcros.so. |
1030 if (!freopen(log_file_name.c_str(), "a", stderr)) { | 1032 if (!freopen(log_file_name.c_str(), "a", stderr)) { |
1031 LOG(INFO) << "Failed to redirect stderr to " << log_file_name.c_str(); | 1033 LOG(INFO) << "Failed to redirect stderr to " << log_file_name.c_str(); |
(...skipping 13 matching lines...) Expand all Loading... |
1045 // Create the candidate window controller. | 1047 // Create the candidate window controller. |
1046 chromeos::CandidateWindowController controller; | 1048 chromeos::CandidateWindowController controller; |
1047 controller.Init(); | 1049 controller.Init(); |
1048 | 1050 |
1049 // Start the main loop. | 1051 // Start the main loop. |
1050 views::AcceleratorHandler accelerator_handler; | 1052 views::AcceleratorHandler accelerator_handler; |
1051 MessageLoopForUI::current()->Run(&accelerator_handler); | 1053 MessageLoopForUI::current()->Run(&accelerator_handler); |
1052 | 1054 |
1053 return 0; | 1055 return 0; |
1054 } | 1056 } |
OLD | NEW |