Chromium Code Reviews| Index: chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| index 7cde5b5c20cdc57c1bea63b380a0423e7b4f20e5..64fa45ab69b27c0604f10fbf1f5be7aae50964be 100644 |
| --- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| +++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc |
| @@ -28,6 +28,8 @@ namespace SetIcon = app_current_window_internal::SetIcon; |
| namespace SetBadgeIcon = app_current_window_internal::SetBadgeIcon; |
| namespace SetShape = app_current_window_internal::SetShape; |
| namespace SetAlwaysOnTop = app_current_window_internal::SetAlwaysOnTop; |
| +namespace SetInterceptAllKeys = |
| + app_current_window_internal::SetInterceptAllKeys; |
| using apps::AppWindow; |
| using app_current_window_internal::Bounds; |
| @@ -52,6 +54,11 @@ const char kRequiresFramelessWindow[] = |
| const char kAlwaysOnTopPermission[] = |
| "The \"app.window.alwaysOnTop\" permission is required."; |
| +const char kInterceptAllKeysPermission[] = "app.window.interceptAllKeys"; |
| + |
| +const char kInterceptAllKeysPermissionError[] = |
| + "The \"app.window.interceptAllKeys\" permission is required."; |
| + |
| const char kInvalidParameters[] = "Invalid parameters."; |
| const int kUnboundedSize = apps::SizeConstraints::kUnboundedSize; |
| @@ -399,4 +406,24 @@ bool AppCurrentWindowInternalSetAlwaysOnTopFunction::RunWithWindow( |
| return true; |
| } |
| +bool AppCurrentWindowInternalSetInterceptAllKeysFunction::RunWithWindow( |
| + AppWindow* window) { |
| + if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV) { |
|
benwells
2014/08/01 00:32:43
As mentioned I don't think this is needed as you a
Sriram
2014/08/11 21:01:28
Done.
|
| + error_ = kDevChannelOnly; |
| + return false; |
| + } |
| + |
| + if (!extension()->permissions_data()->HasAPIPermission( |
| + kInterceptAllKeysPermission)) { |
| + error_ = kInterceptAllKeysPermissionError; |
| + return false; |
| + } |
| + |
| + scoped_ptr<SetInterceptAllKeys::Params> params( |
| + SetInterceptAllKeys::Params::Create(*args_)); |
| + CHECK(params.get()); |
| + window->SetInterceptAllKeys(params->want_all_keys); |
| + return true; |
| +} |
| + |
| } // namespace extensions |