| OLD | NEW |
| 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.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/idle_timer.h" | 8 #include "base/idle_timer.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 UserMetrics::RecordAction(L"ZoomMinus", profile_); | 897 UserMetrics::RecordAction(L"ZoomMinus", profile_); |
| 898 GetSelectedTabContents()->AsWebContents()->render_view_host()->Zoom( | 898 GetSelectedTabContents()->AsWebContents()->render_view_host()->Zoom( |
| 899 PageZoom::SMALLER); | 899 PageZoom::SMALLER); |
| 900 } | 900 } |
| 901 | 901 |
| 902 #if defined(OS_WIN) | 902 #if defined(OS_WIN) |
| 903 void Browser::FocusToolbar() { | 903 void Browser::FocusToolbar() { |
| 904 UserMetrics::RecordAction(L"FocusToolbar", profile_); | 904 UserMetrics::RecordAction(L"FocusToolbar", profile_); |
| 905 window_->FocusToolbar(); | 905 window_->FocusToolbar(); |
| 906 } | 906 } |
| 907 #endif |
| 907 | 908 |
| 909 #if defined(OS_WIN) || defined(OS_LINUX) |
| 908 void Browser::FocusLocationBar() { | 910 void Browser::FocusLocationBar() { |
| 909 UserMetrics::RecordAction(L"FocusLocation", profile_); | 911 UserMetrics::RecordAction(L"FocusLocation", profile_); |
| 910 window_->GetLocationBar()->FocusLocation(); | 912 window_->SetFocusToLocationBar(); |
| 911 } | 913 } |
| 912 | 914 |
| 913 void Browser::FocusSearch() { | 915 void Browser::FocusSearch() { |
| 914 // TODO(beng): replace this with FocusLocationBar | 916 // TODO(beng): replace this with FocusLocationBar |
| 915 UserMetrics::RecordAction(L"FocusSearch", profile_); | 917 UserMetrics::RecordAction(L"FocusSearch", profile_); |
| 916 window_->GetLocationBar()->FocusSearch(); | 918 window_->GetLocationBar()->FocusSearch(); |
| 917 } | 919 } |
| 920 #endif |
| 918 | 921 |
| 922 #if defined(OS_WIN) || defined(OS_LINUX) |
| 919 void Browser::OpenFile() { | 923 void Browser::OpenFile() { |
| 920 UserMetrics::RecordAction(L"OpenFile", profile_); | 924 UserMetrics::RecordAction(L"OpenFile", profile_); |
| 921 if (!select_file_dialog_.get()) | 925 if (!select_file_dialog_.get()) |
| 922 select_file_dialog_ = SelectFileDialog::Create(this); | 926 select_file_dialog_ = SelectFileDialog::Create(this); |
| 923 | 927 |
| 924 // TODO(beng): figure out how to juggle this. | 928 // TODO(beng): figure out how to juggle this. |
| 925 HWND parent_hwnd = reinterpret_cast<HWND>(window_->GetNativeHandle()); | 929 gfx::NativeWindow parent_window = window_->GetNativeHandle(); |
| 926 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 930 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
| 927 std::wstring(), std::wstring(), | 931 std::wstring(), std::wstring(), |
| 928 std::wstring(), std::wstring(), | 932 std::wstring(), std::wstring(), |
| 929 parent_hwnd, NULL); | 933 parent_window, NULL); |
| 930 } | 934 } |
| 935 #endif |
| 931 | 936 |
| 937 #if defined(OS_WIN) |
| 932 void Browser::OpenCreateShortcutsDialog() { | 938 void Browser::OpenCreateShortcutsDialog() { |
| 933 UserMetrics::RecordAction(L"CreateShortcut", profile_); | 939 UserMetrics::RecordAction(L"CreateShortcut", profile_); |
| 934 GetSelectedTabContents()->AsWebContents()->CreateShortcut(); | 940 GetSelectedTabContents()->AsWebContents()->CreateShortcut(); |
| 935 } | 941 } |
| 936 | 942 |
| 937 void Browser::OpenDebuggerWindow() { | 943 void Browser::OpenDebuggerWindow() { |
| 938 #ifndef CHROME_DEBUGGER_DISABLED | 944 #ifndef CHROME_DEBUGGER_DISABLED |
| 939 UserMetrics::RecordAction(L"Debugger", profile_); | 945 UserMetrics::RecordAction(L"Debugger", profile_); |
| 940 TabContents* current_tab = GetSelectedTabContents(); | 946 TabContents* current_tab = GetSelectedTabContents(); |
| 941 if (current_tab->AsWebContents()) { | 947 if (current_tab->AsWebContents()) { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 // Find-in-page | 1214 // Find-in-page |
| 1209 case IDC_FIND: Find(); break; | 1215 case IDC_FIND: Find(); break; |
| 1210 case IDC_FIND_NEXT: FindNext(); break; | 1216 case IDC_FIND_NEXT: FindNext(); break; |
| 1211 case IDC_FIND_PREVIOUS: FindPrevious(); break; | 1217 case IDC_FIND_PREVIOUS: FindPrevious(); break; |
| 1212 | 1218 |
| 1213 // Zoom | 1219 // Zoom |
| 1214 case IDC_ZOOM_PLUS: ZoomIn(); break; | 1220 case IDC_ZOOM_PLUS: ZoomIn(); break; |
| 1215 case IDC_ZOOM_NORMAL: ZoomReset(); break; | 1221 case IDC_ZOOM_NORMAL: ZoomReset(); break; |
| 1216 case IDC_ZOOM_MINUS: ZoomOut(); break; | 1222 case IDC_ZOOM_MINUS: ZoomOut(); break; |
| 1217 | 1223 |
| 1224 // Focus various bits of UI |
| 1218 #if defined(OS_WIN) | 1225 #if defined(OS_WIN) |
| 1219 // Focus various bits of UI | |
| 1220 case IDC_FOCUS_TOOLBAR: FocusToolbar(); break; | 1226 case IDC_FOCUS_TOOLBAR: FocusToolbar(); break; |
| 1227 #endif |
| 1228 #if defined(OS_WIN) || defined(OS_LINUX) |
| 1221 case IDC_FOCUS_LOCATION: FocusLocationBar(); break; | 1229 case IDC_FOCUS_LOCATION: FocusLocationBar(); break; |
| 1222 case IDC_FOCUS_SEARCH: FocusSearch(); break; | 1230 case IDC_FOCUS_SEARCH: FocusSearch(); break; |
| 1231 #endif |
| 1223 | 1232 |
| 1224 // Show various bits of UI | 1233 // Show various bits of UI |
| 1234 #if defined(OS_WIN)|| defined(OS_LINUX) |
| 1225 case IDC_OPEN_FILE: OpenFile(); break; | 1235 case IDC_OPEN_FILE: OpenFile(); break; |
| 1236 #endif |
| 1237 #if defined(OS_WIN) |
| 1226 case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break; | 1238 case IDC_CREATE_SHORTCUTS: OpenCreateShortcutsDialog(); break; |
| 1227 case IDC_DEBUGGER: OpenDebuggerWindow(); break; | 1239 case IDC_DEBUGGER: OpenDebuggerWindow(); break; |
| 1228 case IDC_JS_CONSOLE: OpenJavaScriptConsole(); break; | 1240 case IDC_JS_CONSOLE: OpenJavaScriptConsole(); break; |
| 1229 case IDC_TASK_MANAGER: OpenTaskManager(); break; | 1241 case IDC_TASK_MANAGER: OpenTaskManager(); break; |
| 1230 case IDC_SELECT_PROFILE: OpenSelectProfileDialog(); break; | 1242 case IDC_SELECT_PROFILE: OpenSelectProfileDialog(); break; |
| 1231 case IDC_NEW_PROFILE: OpenNewProfileDialog(); break; | 1243 case IDC_NEW_PROFILE: OpenNewProfileDialog(); break; |
| 1232 case IDC_REPORT_BUG: OpenBugReportDialog(); break; | 1244 case IDC_REPORT_BUG: OpenBugReportDialog(); break; |
| 1233 case IDC_SHOW_BOOKMARK_BAR: ToggleBookmarkBar(); break; | 1245 case IDC_SHOW_BOOKMARK_BAR: ToggleBookmarkBar(); break; |
| 1234 case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarkManager(); break; | 1246 case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarkManager(); break; |
| 1235 #endif | 1247 #endif |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 | 2492 |
| 2481 // We need to register the window position pref. | 2493 // We need to register the window position pref. |
| 2482 std::wstring window_pref(prefs::kBrowserWindowPlacement); | 2494 std::wstring window_pref(prefs::kBrowserWindowPlacement); |
| 2483 window_pref.append(L"_"); | 2495 window_pref.append(L"_"); |
| 2484 window_pref.append(app_name); | 2496 window_pref.append(app_name); |
| 2485 PrefService* prefs = g_browser_process->local_state(); | 2497 PrefService* prefs = g_browser_process->local_state(); |
| 2486 DCHECK(prefs); | 2498 DCHECK(prefs); |
| 2487 | 2499 |
| 2488 prefs->RegisterDictionaryPref(window_pref.c_str()); | 2500 prefs->RegisterDictionaryPref(window_pref.c_str()); |
| 2489 } | 2501 } |
| OLD | NEW |