Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2782)

Unified Diff: chrome/browser/extensions/global_shortcut_listener_gtk.cc

Issue 23812010: Implement first part of supporting global extension commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gclient sync Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/global_shortcut_listener_gtk.cc
diff --git a/chrome/browser/extensions/global_shortcut_listener_gtk.cc b/chrome/browser/extensions/global_shortcut_listener_gtk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bfb00ced6cb6f17fc29b1a2ecf62df867e1dfba5
--- /dev/null
+++ b/chrome/browser/extensions/global_shortcut_listener_gtk.cc
@@ -0,0 +1,75 @@
+// 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 "chrome/browser/extensions/global_shortcut_listener_gtk.h"
+
+#include "content/public/browser/browser_thread.h"
+
+using content::BrowserThread;
+
+namespace {
+
+static base::LazyInstance<extensions::GlobalShortcutListenerGtk> instance =
+ LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+namespace extensions {
+
+// static
+GlobalShortcutListener* GlobalShortcutListener::GetInstance() {
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ return instance.Pointer();
+}
+
+GlobalShortcutListenerGtk::GlobalShortcutListenerGtk()
+ : is_listening_(false) {
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // TODO(implementor): Remove this.
+ LOG(ERROR) << "GlobalShortcutListenerGtk object created";
+}
+
+GlobalShortcutListenerGtk::~GlobalShortcutListenerGtk() {
+ if (is_listening_)
+ StopListening();
+}
+
+void GlobalShortcutListenerGtk::StartListening() {
+ DCHECK(!is_listening_); // Don't start twice.
+ NOTIMPLEMENTED();
+ is_listening_ = true;
+}
+
+void GlobalShortcutListenerGtk::StopListening() {
+ DCHECK(is_listening_); // No point if we are not already listening.
+ NOTIMPLEMENTED();
+ is_listening_ = false;
+}
+
+void GlobalShortcutListenerGtk::RegisterAccelerator(
+ const ui::Accelerator& accelerator,
+ GlobalShortcutListener::Observer* observer) {
+ NOTIMPLEMENTED();
+ // To implement:
+ // 1) Convert modifiers to platform specific modifiers.
+ // 2) Register for the hotkey.
+ // 3) If not successful, log why.
+ // 4) Else, call base class RegisterAccelerator.
+
+ GlobalShortcutListener::RegisterAccelerator(accelerator, observer);
+}
+
+void GlobalShortcutListenerGtk::UnregisterAccelerator(
+ const ui::Accelerator& accelerator,
+ GlobalShortcutListener::Observer* observer) {
+ NOTIMPLEMENTED();
+ // To implement:
+ // 1) Unregister for the hotkey.
+ // 2) Call base class UnregisterAccelerator.
+
+ GlobalShortcutListener::UnregisterAccelerator(accelerator, observer);
+}
+
+} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/global_shortcut_listener_gtk.h ('k') | chrome/browser/extensions/global_shortcut_listener_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698