OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "app/animation.h" | 7 #include "app/animation.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 window()->ConfirmAddSearchProvider(template_url, profile); | 2101 window()->ConfirmAddSearchProvider(template_url, profile); |
2102 } | 2102 } |
2103 | 2103 |
2104 void Browser::ShowPageInfo(Profile* profile, | 2104 void Browser::ShowPageInfo(Profile* profile, |
2105 const GURL& url, | 2105 const GURL& url, |
2106 const NavigationEntry::SSLStatus& ssl, | 2106 const NavigationEntry::SSLStatus& ssl, |
2107 bool show_history) { | 2107 bool show_history) { |
2108 window()->ShowPageInfo(profile, url, ssl, show_history); | 2108 window()->ShowPageInfo(profile, url, ssl, show_history); |
2109 } | 2109 } |
2110 | 2110 |
| 2111 bool Browser::IsReservedAccelerator(const NativeWebKeyboardEvent& event) { |
| 2112 // Other platforms don't send close-app keyboard shortcuts to apps first. |
| 2113 #if defined(OS_WIN) |
| 2114 if ((event.modifiers & NativeWebKeyboardEvent::AltKey) && |
| 2115 event.windowsKeyCode == VK_F4) { |
| 2116 return true; |
| 2117 } |
| 2118 #endif |
| 2119 |
| 2120 int command_id = window()->GetCommandId(event); |
| 2121 return command_id == IDC_CLOSE_TAB || |
| 2122 command_id == IDC_CLOSE_POPUPS || |
| 2123 command_id == IDC_CLOSE_WINDOW || |
| 2124 command_id == IDC_NEW_INCOGNITO_WINDOW || |
| 2125 command_id == IDC_NEW_TAB || |
| 2126 command_id == IDC_NEW_WINDOW || |
| 2127 command_id == IDC_RESTORE_TAB || |
| 2128 command_id == IDC_SELECT_NEXT_TAB || |
| 2129 command_id == IDC_SELECT_PREVIOUS_TAB || |
| 2130 command_id == IDC_TASK_MANAGER; |
| 2131 } |
| 2132 |
2111 void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { | 2133 void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { |
2112 window()->ShowRepostFormWarningDialog(tab_contents); | 2134 window()->ShowRepostFormWarningDialog(tab_contents); |
2113 } | 2135 } |
2114 | 2136 |
2115 /////////////////////////////////////////////////////////////////////////////// | 2137 /////////////////////////////////////////////////////////////////////////////// |
2116 // Browser, SelectFileDialog::Listener implementation: | 2138 // Browser, SelectFileDialog::Listener implementation: |
2117 | 2139 |
2118 void Browser::FileSelected(const FilePath& path, int index, void* params) { | 2140 void Browser::FileSelected(const FilePath& path, int index, void* params) { |
2119 GURL file_url = net::FilePathToFileURL(path); | 2141 GURL file_url = net::FilePathToFileURL(path); |
2120 if (!file_url.is_empty()) | 2142 if (!file_url.is_empty()) |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2942 /////////////////////////////////////////////////////////////////////////////// | 2964 /////////////////////////////////////////////////////////////////////////////// |
2943 // BrowserToolbarModel (private): | 2965 // BrowserToolbarModel (private): |
2944 | 2966 |
2945 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { | 2967 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { |
2946 // This |current_tab| can be NULL during the initialization of the | 2968 // This |current_tab| can be NULL during the initialization of the |
2947 // toolbar during window creation (i.e. before any tabs have been added | 2969 // toolbar during window creation (i.e. before any tabs have been added |
2948 // to the window). | 2970 // to the window). |
2949 TabContents* current_tab = browser_->GetSelectedTabContents(); | 2971 TabContents* current_tab = browser_->GetSelectedTabContents(); |
2950 return current_tab ? ¤t_tab->controller() : NULL; | 2972 return current_tab ? ¤t_tab->controller() : NULL; |
2951 } | 2973 } |
OLD | NEW |