| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 | 2010 |
| 2011 /////////////////////////////////////////////////////////////////////////////// | 2011 /////////////////////////////////////////////////////////////////////////////// |
| 2012 // BrowserView, ui::AcceleratorTarget overrides: | 2012 // BrowserView, ui::AcceleratorTarget overrides: |
| 2013 | 2013 |
| 2014 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 2014 bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 2015 std::map<ui::Accelerator, int>::const_iterator iter = | 2015 std::map<ui::Accelerator, int>::const_iterator iter = |
| 2016 accelerator_table_.find(accelerator); | 2016 accelerator_table_.find(accelerator); |
| 2017 DCHECK(iter != accelerator_table_.end()); | 2017 DCHECK(iter != accelerator_table_.end()); |
| 2018 int command_id = iter->second; | 2018 int command_id = iter->second; |
| 2019 | 2019 |
| 2020 if (accelerator.IsRepeat() && !repeatable_command_ids_.count(command_id)) |
| 2021 return false; |
| 2022 |
| 2020 chrome::BrowserCommandController* controller = browser_->command_controller(); | 2023 chrome::BrowserCommandController* controller = browser_->command_controller(); |
| 2021 if (!controller->block_command_execution()) | 2024 if (!controller->block_command_execution()) |
| 2022 UpdateAcceleratorMetrics(accelerator, command_id); | 2025 UpdateAcceleratorMetrics(accelerator, command_id); |
| 2023 return chrome::ExecuteCommand(browser_.get(), command_id); | 2026 return chrome::ExecuteCommand(browser_.get(), command_id); |
| 2024 } | 2027 } |
| 2025 | 2028 |
| 2026 /////////////////////////////////////////////////////////////////////////////// | 2029 /////////////////////////////////////////////////////////////////////////////// |
| 2027 // BrowserView, OmniboxPopupModelObserver overrides: | 2030 // BrowserView, OmniboxPopupModelObserver overrides: |
| 2028 void BrowserView::OnOmniboxPopupShownOrHidden() { | 2031 void BrowserView::OnOmniboxPopupShownOrHidden() { |
| 2029 SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight(), infobar_container_); | 2032 SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight(), infobar_container_); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2399 if (is_app_mode && !chrome::IsCommandAllowedInAppMode(it->command_id)) | 2402 if (is_app_mode && !chrome::IsCommandAllowedInAppMode(it->command_id)) |
| 2400 continue; | 2403 continue; |
| 2401 | 2404 |
| 2402 ui::Accelerator accelerator(it->keycode, it->modifiers); | 2405 ui::Accelerator accelerator(it->keycode, it->modifiers); |
| 2403 accelerator_table_[accelerator] = it->command_id; | 2406 accelerator_table_[accelerator] = it->command_id; |
| 2404 | 2407 |
| 2405 // Also register with the focus manager. | 2408 // Also register with the focus manager. |
| 2406 focus_manager->RegisterAccelerator( | 2409 focus_manager->RegisterAccelerator( |
| 2407 accelerator, ui::AcceleratorManager::kNormalPriority, this); | 2410 accelerator, ui::AcceleratorManager::kNormalPriority, this); |
| 2408 } | 2411 } |
| 2412 |
| 2413 repeatable_command_ids_ = chrome::GetRepeatableCommandIds(); |
| 2409 } | 2414 } |
| 2410 | 2415 |
| 2411 int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const { | 2416 int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const { |
| 2412 #if defined(OS_WIN) | 2417 #if defined(OS_WIN) |
| 2413 switch (app_command_id) { | 2418 switch (app_command_id) { |
| 2414 // NOTE: The order here matches the APPCOMMAND declaration order in the | 2419 // NOTE: The order here matches the APPCOMMAND declaration order in the |
| 2415 // Windows headers. | 2420 // Windows headers. |
| 2416 case APPCOMMAND_BROWSER_BACKWARD: return IDC_BACK; | 2421 case APPCOMMAND_BROWSER_BACKWARD: return IDC_BACK; |
| 2417 case APPCOMMAND_BROWSER_FORWARD: return IDC_FORWARD; | 2422 case APPCOMMAND_BROWSER_FORWARD: return IDC_FORWARD; |
| 2418 case APPCOMMAND_BROWSER_REFRESH: return IDC_RELOAD; | 2423 case APPCOMMAND_BROWSER_REFRESH: return IDC_RELOAD; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 } | 2670 } |
| 2666 | 2671 |
| 2667 extensions::ActiveTabPermissionGranter* | 2672 extensions::ActiveTabPermissionGranter* |
| 2668 BrowserView::GetActiveTabPermissionGranter() { | 2673 BrowserView::GetActiveTabPermissionGranter() { |
| 2669 content::WebContents* web_contents = GetActiveWebContents(); | 2674 content::WebContents* web_contents = GetActiveWebContents(); |
| 2670 if (!web_contents) | 2675 if (!web_contents) |
| 2671 return nullptr; | 2676 return nullptr; |
| 2672 return extensions::TabHelper::FromWebContents(web_contents) | 2677 return extensions::TabHelper::FromWebContents(web_contents) |
| 2673 ->active_tab_permission_granter(); | 2678 ->active_tab_permission_granter(); |
| 2674 } | 2679 } |
| OLD | NEW |