forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chrome: Ozone Aura needs the newly global extension commands also.
The offending CL https://codereview.chromium.org/23812010 has introduced changes that break Ozone platform support. This CL make the necessary changes, moving the Aura X11 specific code to be now compiled with generic Aura solutions as well. In particular, this brings back support for Chrome browser in Ozone-Wayland. BUG=302437 Review URL: https://codereview.chromium.org/26539009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229865 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
tiago.vignatti@intel.com
committed
Oct 21, 2013
1 parent
9aba6f6
commit 02a6a18
Showing
3 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
chrome/browser/extensions/global_shortcut_listener_ozone.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright 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_ozone.h" | ||
|
||
#include "content/public/browser/browser_thread.h" | ||
|
||
using content::BrowserThread; | ||
|
||
namespace { | ||
|
||
static base::LazyInstance<extensions::GlobalShortcutListenerOzone> instance = | ||
LAZY_INSTANCE_INITIALIZER; | ||
|
||
} // namespace | ||
|
||
namespace extensions { | ||
|
||
// static | ||
GlobalShortcutListener* GlobalShortcutListener::GetInstance() { | ||
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | ||
return instance.Pointer(); | ||
} | ||
|
||
GlobalShortcutListenerOzone::GlobalShortcutListenerOzone() | ||
: is_listening_(false) { | ||
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | ||
|
||
// TODO(implementor): Remove this. | ||
LOG(ERROR) << "GlobalShortcutListenerOzone object created"; | ||
} | ||
|
||
GlobalShortcutListenerOzone::~GlobalShortcutListenerOzone() { | ||
if (is_listening_) | ||
StopListening(); | ||
} | ||
|
||
void GlobalShortcutListenerOzone::StartListening() { | ||
DCHECK(!is_listening_); // Don't start twice. | ||
NOTIMPLEMENTED(); | ||
is_listening_ = true; | ||
} | ||
|
||
void GlobalShortcutListenerOzone::StopListening() { | ||
DCHECK(is_listening_); // No point if we are not already listening. | ||
NOTIMPLEMENTED(); | ||
is_listening_ = false; | ||
} | ||
|
||
void GlobalShortcutListenerOzone::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 GlobalShortcutListenerOzone::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 |
45 changes: 45 additions & 0 deletions
45
chrome/browser/extensions/global_shortcut_listener_ozone.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 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. | ||
|
||
#ifndef CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_OZONE_H_ | ||
#define CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_OZONE_H_ | ||
|
||
#include "base/lazy_instance.h" | ||
#include "chrome/browser/extensions/global_shortcut_listener.h" | ||
|
||
namespace extensions { | ||
|
||
// Ozone-specific implementation of the GlobalShortcutListener class that | ||
// listens for global shortcuts. Handles basic keyboard intercepting and | ||
// forwards its output to the base class for processing. | ||
class GlobalShortcutListenerOzone : public GlobalShortcutListener { | ||
public: | ||
virtual ~GlobalShortcutListenerOzone(); | ||
|
||
virtual void StartListening() OVERRIDE; | ||
virtual void StopListening() OVERRIDE; | ||
|
||
private: | ||
friend struct base::DefaultLazyInstanceTraits<GlobalShortcutListenerOzone>; | ||
|
||
GlobalShortcutListenerOzone(); | ||
|
||
// Register an |accelerator| with the particular |observer|. | ||
virtual void RegisterAccelerator( | ||
const ui::Accelerator& accelerator, | ||
GlobalShortcutListener::Observer* observer) OVERRIDE; | ||
// Unregister an |accelerator| with the particular |observer|. | ||
virtual void UnregisterAccelerator( | ||
const ui::Accelerator& accelerator, | ||
GlobalShortcutListener::Observer* observer) OVERRIDE; | ||
|
||
// Whether this object is listening for global shortcuts. | ||
bool is_listening_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(GlobalShortcutListenerOzone); | ||
}; | ||
|
||
} // namespace extensions | ||
|
||
#endif // CHROME_BROWSER_EXTENSIONS_GLOBAL_SHORTCUT_LISTENER_OZONE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters