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

Unified Diff: extensions/browser/app_window/app_window.cc

Issue 297123002: API proposal for chrome.app.window to intercept all keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use WidgetObserver instead of plumbing SetKeyboardIntercept through view::Widget Created 6 years, 1 month 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: extensions/browser/app_window/app_window.cc
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc
index c7990e179848796310266c346858d2ea0e023c42..9ed5d0db2e20408faae359f45e6024e173a26447 100644
--- a/extensions/browser/app_window/app_window.cc
+++ b/extensions/browser/app_window/app_window.cc
@@ -242,7 +242,8 @@ AppWindow::AppWindow(BrowserContext* context,
can_send_events_(false),
is_hidden_(false),
cached_always_on_top_(false),
- requested_alpha_enabled_(false) {
+ requested_alpha_enabled_(false),
+ cached_want_all_keys_(false) {
ExtensionsBrowserClient* client = ExtensionsBrowserClient::Get();
CHECK(!client->IsGuestSession(context) || context->IsOffTheRecord())
<< "Only off the record window may be opened in the guest mode.";
@@ -348,6 +349,10 @@ void AppWindow::Init(const GURL& url,
}
AppWindow::~AppWindow() {
+ if (cached_want_all_keys_) {
benwells 2014/11/21 00:52:01 Why is this necessary? Shouldn't the new WidgetObs
Sriram 2014/11/21 05:35:21 Done.
+ native_app_window_->SetInterceptAllKeys(false);
+ cached_want_all_keys_ = false;
+ }
}
void AppWindow::RequestMediaAccessPermission(
@@ -710,6 +715,13 @@ void AppWindow::SetAlwaysOnTop(bool always_on_top) {
bool AppWindow::IsAlwaysOnTop() const { return cached_always_on_top_; }
+void AppWindow::SetInterceptAllKeys(bool want_all_keys) {
+ if (cached_want_all_keys_ != want_all_keys) {
+ native_app_window_->SetInterceptAllKeys(want_all_keys);
+ cached_want_all_keys_ = want_all_keys;
+ }
+}
+
void AppWindow::WindowEventsReady() {
can_send_events_ = true;
SendOnWindowShownIfShown();

Powered by Google App Engine
This is Rietveld 408576698