Index: chrome/browser/ui/views/accelerator_utils_views.cc |
diff --git a/chrome/browser/ui/views/accelerator_utils_views.cc b/chrome/browser/ui/views/accelerator_utils_views.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4520e7cf07eb7c9cd4de9ea835708d3005c9cb67 |
--- /dev/null |
+++ b/chrome/browser/ui/views/accelerator_utils_views.cc |
@@ -0,0 +1,23 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/base/accelerators/accelerator.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_finder.h" |
+#include "chrome/browser/ui/views/frame/browser_view.h" |
+ |
+namespace chrome { |
+ |
+bool IsChromeAccelerator(const ui::Accelerator& accelerator, Profile* profile) { |
+ Browser* browser = chrome::FindLastActiveWithProfile( |
+ profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
+ if (!browser) |
+ return false; |
+ BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( |
+ browser->window()->GetNativeWindow()); |
+ return browser_view->IsAcceleratorRegistered(accelerator); |
+} |
+ |
+} // namespace chrome |